.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

shadowing and overriding

Posted By: seattlegirl     Posted Date: June 14, 2011    Points:5   Category :C#
what is the difference between shadowing and overriding?please explain in simple english without being too technical.

Responses
Author: Gowthammanju             
Posted Date: June 14, 2011     Points: 20   

Hey

check this link for

Difference: http://msdn.microsoft.com/en-us/library/ms172785.aspx

Example http://stackoverflow.com/questions/392721/difference-between-shadowing-and-overriding-in-c

Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: Gowthammanju             
Posted Date: June 14, 2011     Points: 20   

Hey in simple it is

shadowing:

Super class reference can point to the subclass instance and can't access the subclass members


Overloading: Super class reference can point to the sub class instance and can access sub class members


To overcome shadowing .NET introduced overloading

Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: Ravi Ranjan Kumar             
Posted Date: June 29, 2011     Points: 20   

Gowthammanju already given you perfect answer, In addition to Gowthammanju answer I've listed some point about shadowing and overriding.
Take a look
a) Overriding makes the base class method invisible whereas Shadowing a field only hides the field from view.
b) Shadowing redefines the whole element while Overriding redefines only the implementation
c) In overriding derived classes can refer the parent class element by using "ME" keyword , but in shadowing you can access it by "MYBASE".


Thanks & Regards
Ravi Ranjan Kumar
http://raviranjankr.wordpress.com


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend