<?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>method overriding in c# with real time example - Wikitechy</title>
	<atom:link href="https://www.wikitechy.com/interview-questions/tag/method-overriding-in-c-with-real-time-example/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.wikitechy.com/interview-questions/tag/method-overriding-in-c-with-real-time-example/</link>
	<description>Interview Questions</description>
	<lastBuildDate>Sat, 11 Sep 2021 11:38:00 +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>method overriding in c# with real time example - Wikitechy</title>
	<link>https://www.wikitechy.com/interview-questions/tag/method-overriding-in-c-with-real-time-example/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>What is the purpose of method overriding in java where we are completely re-defining a inherited method ?</title>
		<link>https://www.wikitechy.com/interview-questions/java/what-is-the-purpose-of-method-overriding-in-java-where-we-are-completely-re-defining-a-inherited-method/</link>
					<comments>https://www.wikitechy.com/interview-questions/java/what-is-the-purpose-of-method-overriding-in-java-where-we-are-completely-re-defining-a-inherited-method/#respond</comments>
		
		<dc:creator><![CDATA[Editor]]></dc:creator>
		<pubDate>Tue, 13 Jul 2021 23:07:03 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Accenture interview questions and answers]]></category>
		<category><![CDATA[Applied Materials interview questions and answers]]></category>
		<category><![CDATA[Atos interview questions and answers]]></category>
		<category><![CDATA[Capgemini interview questions and answers]]></category>
		<category><![CDATA[CASTING NETWORKS INDIA PVT LIMITED interview questions and answers]]></category>
		<category><![CDATA[CGI Group Inc interview questions and answers]]></category>
		<category><![CDATA[Chetu interview questions and answers]]></category>
		<category><![CDATA[Ciena Corporation interview questions and answers]]></category>
		<category><![CDATA[Collabera Technologies interview questions and answers]]></category>
		<category><![CDATA[Dell International Services India Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[difference between overloading and overriding in java]]></category>
		<category><![CDATA[FIS Global Business Solutions India Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[Flipkart interview questions and answers]]></category>
		<category><![CDATA[IBM interview questions and answers]]></category>
		<category><![CDATA[Indecomm Global Services interview questions and answers]]></category>
		<category><![CDATA[Infosys Technologies interview questions and answers]]></category>
		<category><![CDATA[kumaran systems interview questions and answers]]></category>
		<category><![CDATA[L&T Infotech interview questions and answers]]></category>
		<category><![CDATA[method overloading and method overriding in java with realtime examples]]></category>
		<category><![CDATA[method overloading and overriding in c#]]></category>
		<category><![CDATA[method overriding in c# tutorialspoint]]></category>
		<category><![CDATA[method overriding in c# with real time example]]></category>
		<category><![CDATA[method overriding java]]></category>
		<category><![CDATA[Mphasis interview questions and answers]]></category>
		<category><![CDATA[NetApp interview questions and answers]]></category>
		<category><![CDATA[Oracle Corporation interview questions and answers]]></category>
		<category><![CDATA[overloading and overriding in oops]]></category>
		<category><![CDATA[overriding java]]></category>
		<category><![CDATA[PeopleStrong interview questions and answers]]></category>
		<category><![CDATA[Persistent Systems interview questions and answers]]></category>
		<category><![CDATA[RBS India De interview questions and answers]]></category>
		<category><![CDATA[Reliance Industries Ltd interview questions and answers]]></category>
		<category><![CDATA[SAP Labs India Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[Tech Mahindra interview questions and answers]]></category>
		<category><![CDATA[UnitedHealth Group interview questions and answers]]></category>
		<category><![CDATA[Virtusa Consulting Services Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[Wells Fargo interview questions and answers]]></category>
		<category><![CDATA[why we use method overriding in java]]></category>
		<category><![CDATA[Wipro Infotech interview questions and answers]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=626</guid>

					<description><![CDATA[Answer : Exception in Java represents that problem arises during the execution of the program...]]></description>
										<content:encoded><![CDATA[<div class="TextHeading">
<div class="hddn">
<h2 id="method-overriding-in-java" class="color-purple" style="text-align: justify;">Method overriding in java</h2>
</div>
</div>
<div class="Content" style="text-align: justify;">
<div class="hddn">
<ul>
<li>Declaring a method in sub class which is already present in parent class is known as method overriding.</li>
<li>Overriding is done so that a child class can give its own implementation to a method which is already provided by the parent class.</li>
<li>In this case the method in parent class is called overridden method and the method in child class is called overriding method.</li>
</ul>
</div>
</div>
<div class="TextHeading" style="text-align: justify;">
<div class="hddn">
<h2 id="purpose-of-method-overriding" class="color-purple">Purpose of method overriding</h2>
</div>
</div>
<div class="Content" style="text-align: justify;">
<div class="hddn">
<ul>
<li>The main purpose of method overriding is that the class can give its own specific implementation to a inherited method without even modifying the parent class code.</li>
<li>This is helpful when a class has several child classes, so if a child class needs to use the parent class method, it can use it and the other classes that want to have different implementation can use overriding feature to make changes without touching the parent class code.</li>
</ul>
</div>
</div>
<div class="text-center row" style="text-align: justify;"></div>
<div class="TextHeading" style="text-align: justify;">
<div class="hddn">
<h2 id="difference-between-redefining-and-overriding" class="color-blue">Difference between Redefining and Overriding</h2>
</div>
</div>
<div class="Content" style="text-align: justify;">
<div class="hddn">
<ul>
<li>The term &#8220;redefinition&#8221; isn&#8217;t usually used with regards to Java methods and inheritance. There are two terms that are commonly used: &#8220;override&#8221; and &#8220;overload.&#8221;</li>
<li>Redefining and Overriding comes with in the same scenarios. Only difference is that if methods used are Static, its redefining.For Example,</li>
</ul>
</div>
</div>
<div class="TextHeading" style="text-align: justify;">
<div class="hddn">
<h2 id="overriding" class="color-green">Overriding</h2>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-java code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-java code-embed-code">Class A<br/>{<br/>      public void show(){<br/>             SOP(&quot;class a&quot;);<br/>        }<br/>   }<br/><br/>   Class B extends A<br/>{<br/>     public void show(){<br/>         SOP(&quot;class B&quot;);<br/>     }<br/>   }</code></pre> </div>
</div>
</div>
<div class="TextHeading" style="text-align: justify;">
<div class="hddn">
<h2 id="redefining" class="color-green">Redefining</h2>
</div>
</div>
<div class="CodeContent" style="text-align: justify;">
<div class="hddn">
<figure class="highlight"><div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-java code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-java code-embed-code">Class A<br/>{<br/>      public static void show(){<br/>             SOP(&quot;class a&quot;);<br/>        }<br/>   }<br/><br/>   Class B extends A<br/>{<br/>     public static void show(){<br/>         SOP(&quot;class B&quot;);<br/>     }<br/>   }</code></pre> </div></figure>
</div>
</div>
<p class="note" style="text-align: justify;">Note: Static methods looks as if they are over-rided but they are actually redefined.</p>
<div class="Content" style="text-align: justify;">
<div class="hddn">
<ul>
<li>Redefining is with Static Methods.</li>
<li>Static methods are associated with Class and not with Object, so we do not override as per instance for run-time.</li>
<li>In case of static we are just redefining the method.</li>
</ul>
</div>
</div>
<div class="TextHeading" style="text-align: justify;">
<div class="hddn">
<h2 id="re-defining-a-inherited-method" class="color-purple">Re-defining a Inherited Method</h2>
<ul>
<li>Re-defining involves a inherited method like Replacement and Refinement</li>
</ul>
</div>
</div>
<div class="TextHeading" style="text-align: justify;">
<div class="hddn">
<h2 id="replacement" class="color-blue">Replacement</h2>
</div>
</div>
<div class="CodeContent" style="text-align: justify;">
<div class="hddn">
<figure class="highlight">
<pre><code id="code3" class="hljs bash" data-lang=""><span class="nt">**Replacement** is the <span class="hljs-keyword">case</span> <span class="hljs-keyword">in</span> <span class="hljs-built_in">which</span> child class is overriding</span></code></pre>
</figure>
</div>
</div>
<div class="Content" style="text-align: justify;">
<div class="hddn">
<ul>
<li>The inherited method of parent class with a behavior(functionality) which is completely different from corresponding parent method and a sign for this process is not calling super.method() in the body of child method.</li>
</ul>
</div>
</div>
<div class="TextHeading" style="text-align: justify;">
<div class="hddn">
<h2 id="refinement" class="color-blue">Refinement</h2>
</div>
</div>
<div class="Output" style="text-align: justify;">
<div class="hddn">
<figure class="highlight">
<pre><code class="hljs bash" data-lang=""><span class="nt">Refinement is the <span class="hljs-keyword">case</span> <span class="hljs-keyword">in</span> <span class="hljs-built_in">which</span> child is overriding inherited  </span></code></pre>
</figure>
</div>
</div>
<div class="Content">
<div class="hddn">
<ul>
<li style="text-align: justify;">The method from parent with a functionality related to parent method functionality, sign of this process is calling generally super.method() in the body of child method.</li>
</ul>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/java/what-is-the-purpose-of-method-overriding-in-java-where-we-are-completely-re-defining-a-inherited-method/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
