{"id":9994,"date":"2023-10-27T08:41:38","date_gmt":"2023-10-27T08:41:38","guid":{"rendered":"https:\/\/adelnasim.com\/docs\/courses\/cpp-tutorial\/function-part-8-overloading-function\/"},"modified":"2024-04-07T01:19:31","modified_gmt":"2024-04-07T01:19:31","slug":"function-part-8-overloading-function","status":"publish","type":"docs","link":"https:\/\/adelnasim.com\/ar\/docs\/courses\/cpp-tutorial\/function-part-8-overloading-function\/","title":{"rendered":"\u0627\u0644\u062f\u0651\u0627\u0644\u0651\u0629 (8) - Overloading Function"},"content":{"rendered":"<p data-sourcepos=\"1:1-1:158\">Function overloading \u0623\u0648 \u0627\u0644\u062a\u062d\u0645\u064a\u0644 \u0627\u0644\u0632\u0627\u0626\u062f \u0644\u0644\u062f\u0648\u0627\u0644 \u0647\u0648 \u0625\u062d\u062f\u0649 \u0645\u064a\u0632\u0627\u062a \u0644\u063a\u0629 C++ \u0627\u0644\u062a\u064a \u062a\u062a\u064a\u062d \u0644\u0643 \u0627\u0644\u062d\u0635\u0648\u0644 \u0639\u0644\u0649 \u062f\u0627\u0644\u062a\u064a\u0646 \u0623\u0648 \u0623\u0643\u062b\u0631 \u0628\u0646\u0641\u0633 \u0627\u0644\u0627\u0633\u0645\u060c \u0637\u0627\u0644\u0645\u0627 \u0623\u0646 \u0644\u062f\u064a\u0647\u0645 parameters  \u0645\u062e\u062a\u0644\u0641\u0629. \u064a\u0645\u0643\u0646 \u0623\u0646 \u064a\u0643\u0648\u0646 \u0647\u0630\u0627 \u0645\u0641\u064a\u062f\u064b\u0627 \u0639\u0646\u062f\u0645\u0627 \u062a\u0631\u064a\u062f \u0627\u0644\u062d\u0635\u0648\u0644 \u0639\u0644\u0649 \u062f\u0627\u0644\u0629 \u0648\u0627\u062d\u062f\u0629 \u064a\u0645\u0643\u0646\u0647\u0627 \u062a\u0646\u0641\u064a\u0630 \u0645\u0647\u0627\u0645 \u0645\u062e\u062a\u0644\u0641\u0629\u060c \u0627\u0639\u062a\u0645\u0627\u062f\u064b\u0627 \u0639\u0644\u0649 \u0646\u0648\u0639 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a \u0627\u0644\u062a\u064a \u064a\u062a\u0645 \u062a\u0645\u0631\u064a\u0631\u0647\u0627 \u0625\u0644\u064a\u0647\u0627 \u0643\u0640 argument.<\/p>\n<p data-sourcepos=\"1:1-1:158\">\u0639\u0644\u0649 \u0633\u0628\u064a\u0644 \u0627\u0644\u0645\u062b\u0627\u0644\u060c \u0647\u0630\u0627 \u0627\u0644\u0628\u0631\u0646\u0627\u0645\u062c \u0639\u0628\u0627\u0631\u0629 \u0639\u0646 \u0645\u062c\u0645\u0648\u0639\u0629 \u0645\u0646 \u062b\u0644\u0627\u062b \u062f\u0648\u0627\u0644 \u0627\u0644\u062a\u064a \u062a\u0637\u0628\u0639 \u0623\u0646\u0648\u0627\u0639\u064b\u0627 \u0645\u062e\u062a\u0644\u0641\u0629 \u0645\u0646 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a \u0625\u0644\u0649 \u0634\u0627\u0634\u0629 \u0627\u0644\u0645\u062e\u0631\u062c\u0627\u062a.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;\r\nusing namespace std;\r\n\r\nvoid print(int a)\r\n{\r\n    cout &lt;&lt; \"Integer = \" &lt;&lt; a &lt;&lt; endl;\r\n}\r\nvoid print(float a)\r\n{\r\n    cout &lt;&lt; \"Float = \" &lt;&lt; a &lt;&lt; endl;\r\n}\r\nvoid print(char c)\r\n{\r\n    cout &lt;&lt; \"Character = \" &lt;&lt; c &lt;&lt; endl;\r\n}\r\n\r\nint main()\r\n{\r\n    print(1);\r\n    print('a');\r\n    return 0;\r\n}<\/pre>\n<p data-sourcepos=\"3:1-3:32\">\u0627\u0644\u062f\u0627\u0644\u0629 \u0627\u0644\u0623\u0648\u0644\u0649\u060c <code class=\"\">print(int a)<\/code>\u060c \u062a\u0623\u062e\u0630 \u0639\u062f\u062f\u064b\u0627 \u0635\u062d\u064a\u062d\u064b\u0627 \u0643\u0640 argument \u0648\u062a\u0637\u0628\u0639\u0647 \u0639\u0644\u0649 \u0634\u0627\u0634\u0629 \u0627\u0644\u0645\u062e\u0631\u062c\u0627\u062a \u0628\u0627\u0644\u0640 (prefix)  \"Integer =\".<\/p>\n<p data-sourcepos=\"5:1-5:36\">\u0627\u0644\u062f\u0627\u0644\u0629 \u0627\u0644\u062b\u0627\u0646\u064a\u0629\u060c <code class=\"\">print(float a)<\/code>\u060c \u062a\u0623\u062e\u0630 \u0631\u0642\u0645\u064b\u0627 \u0639\u0634\u0631\u064a\u0651\u064b\u0627 \u0645\u0646 \u0646\u0648\u0639 float \u0643\u0640argument \u0648\u062a\u0637\u0628\u0639\u0647 \u0639\u0644\u0649 \u0634\u0627\u0634\u0629 \u0627\u0644\u0645\u062e\u0631\u062c\u0627\u062a \u0628\u0640(prefix) \"Float =\".<\/p>\n<p data-sourcepos=\"7:1-7:31\">\u0627\u0644\u062f\u0627\u0644\u0629 \u0627\u0644\u062b\u0627\u0644\u062b\u0629\u060c <code class=\"\">print(char c)<\/code>\u060c \u062a\u0623\u062e\u0630 \u062d\u0631\u0641\u064b\u0627 \u0643\u0640 argument \u0648\u062a\u0637\u0628\u0639\u0647 \u0639\u0644\u0649 \u0634\u0627\u0634\u0629 \u0627\u0644\u0645\u062e\u0631\u062c\u0627\u062a \u0628\u0640 (prefix) \"Character = \".<\/p>\n<p data-sourcepos=\"7:1-7:31\">\u0627\u0644\u0645\u062e\u0631\u062c\u0627\u062a:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Integer = 1\r\nCharacter = a<\/pre>\n<p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>Function overloading is a feature of C++ that allows you to have two or more functions with the same name, as long as they have different parameters. This can be useful when you want to have a single function that can perform different tasks, depending on the type of data that is passed to it [&hellip;]<\/p>","protected":false},"author":3,"featured_media":0,"parent":2744,"menu_order":25,"comment_status":"closed","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-9994","docs","type-docs","status-publish","hentry","no-post-thumbnail"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/docs\/9994","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/comments?post=9994"}],"version-history":[{"count":3,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/docs\/9994\/revisions"}],"predecessor-version":[{"id":9997,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/docs\/9994\/revisions\/9997"}],"up":[{"embeddable":true,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/docs\/2744"}],"wp:attachment":[{"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/media?parent=9994"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/doc_tag?post=9994"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}