<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>operator overloading in c++ - Wikitechy</title>
	<atom:link href="https://www.wikitechy.com/interview-questions/tag/operator-overloading-in-c/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.wikitechy.com/interview-questions/tag/operator-overloading-in-c/</link>
	<description>Interview Questions</description>
	<lastBuildDate>Fri, 19 Aug 2022 08:06:07 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.wikitechy.com/interview-questions/wp-content/uploads/2025/10/cropped-wikitechy-icon-32x32.png</url>
	<title>operator overloading in c++ - Wikitechy</title>
	<link>https://www.wikitechy.com/interview-questions/tag/operator-overloading-in-c/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>What is Overloading ?</title>
		<link>https://www.wikitechy.com/interview-questions/cpp/what-is-overloading/</link>
					<comments>https://www.wikitechy.com/interview-questions/cpp/what-is-overloading/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Fri, 19 Aug 2022 08:06:07 +0000</pubDate>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[c++ function overloading]]></category>
		<category><![CDATA[c++ operator overloading with examples]]></category>
		<category><![CDATA[c++ overloading]]></category>
		<category><![CDATA[function overloading]]></category>
		<category><![CDATA[function overloading in c++]]></category>
		<category><![CDATA[operator overloading in c++]]></category>
		<category><![CDATA[what is overloading in c++]]></category>
		<category><![CDATA[what is overloading in c++ with example]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4794</guid>

					<description><![CDATA[If a single object behaves in many ways, it is known as overloading. It provides different versions of the same function while a single object has the same name. C++ facilitates you to specify more than one definition for an operator or a function in the same scope. Overloading consists of two types, they are: Operator [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li style="text-align: justify;">If a single object behaves in many ways, it is known as overloading.</li>
<li style="text-align: justify;">It provides different versions of the same function while a single object has the same name.</li>
<li style="text-align: justify;"><a href="https://www.wikitechy.com/tutorials/c++/">C++</a> facilitates you to specify more than one definition for an operator or a function in the same scope.</li>
<li style="text-align: justify;">Overloading consists of two types, they are:
<ul>
<li>Operator Overloading</li>
<li>Function Overloading</li>
</ul>
</li>
</ul>
<h2 id="operator-overloading" style="text-align: justify;">Operator Overloading</h2>
<ul style="text-align: justify;">
<li>Operator overloading is otherwise known as <strong>compile-time polymorphism</strong> in which a standard operator is overloaded to provide a user-defined definition to it.</li>
<li><strong>&#8216;+&#8217; operator</strong> is overloaded to perform the addition operation on data types such as float, int, etc.</li>
<li>In following functions operator overloading can be implemented such as <strong>Member function, Non-Member function, Friend Function.</strong></li>
</ul>
<h3 id="sample-code" style="text-align: justify;">Sample Code</h3>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-cpp code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-cpp code-embed-code">using namespace std;    <br/>class Test    <br/>{    <br/>   private:    <br/>      int num;    <br/>   public:    <br/>       Test(): num(8){}    <br/>       void operator ++()         {     <br/>          num = num+2;     <br/>       }    <br/>       void Print() {     <br/>           cout&lt;&lt;&quot;The Count is: &quot;&lt;&lt;num;     <br/>       }    <br/>};    <br/>int main()    <br/>{    <br/>    Test tt;    <br/>    ++tt;  // calling of a function &quot;void operator ++()&quot;    <br/>    tt.Print();    <br/>    return 0;    <br/>}  </code></pre> </div>
<h3 id="output" style="text-align: justify;">Output</h3>
<p style="text-align: justify;"><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-4795" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/operator-overloading.png" alt="" width="1437" height="175" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/operator-overloading.png 1437w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/operator-overloading-300x37.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/operator-overloading-1024x125.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/operator-overloading-768x94.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/operator-overloading-390x47.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/operator-overloading-820x100.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/operator-overloading-1180x144.png 1180w" sizes="(max-width: 1437px) 100vw, 1437px" /></p>
<h2 id="function-overloading" style="text-align: justify;">Function Overloading</h2>
<ul style="text-align: justify;">
<li>Function overloading is a type of compile-time polymorphism which can define a family of functions with the same name.</li>
<li>The function would perform different operations based on the argument list in the function call.</li>
<li>In argument list function to be invoked depends on the number of arguments and the type of the arguments.</li>
</ul>
<h3 id="sample-code-2" style="text-align: justify;">Sample Code</h3>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-cpp code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-cpp code-embed-code">using namespace std;    <br/>class Cal {    <br/>    public:    <br/>static int add(int a,int b){      <br/>        return a + b;      <br/>    }      <br/>static int add(int a, int b, int c)      <br/>    {      <br/>        return a + b + c;      <br/>    }      <br/>};     <br/>int main(void) {    <br/>    Cal C;                                                    //     class object declaration.   <br/>    cout&lt;&lt;C.add(10, 20)&lt;&lt;endl;      <br/>    cout&lt;&lt;C.add(12, 20, 23);     <br/>   return 0;    <br/>}    </code></pre> </div>
<h3 id="output-2" style="text-align: justify;">Output</h3>
<p style="text-align: justify;"><img decoding="async" class="alignnone size-full wp-image-4796" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/function-overloading.png" alt="" width="1423" height="211" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/function-overloading.png 1423w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/function-overloading-300x44.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/function-overloading-1024x152.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/function-overloading-768x114.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/function-overloading-390x58.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/function-overloading-820x122.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/function-overloading-1180x175.png 1180w" sizes="(max-width: 1423px) 100vw, 1423px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/cpp/what-is-overloading/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
