CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS MICROSOFT C# DETAILS
Question :
Difference between shadow and override?



Category C# Interview Questions
Rating (0.0) By 0 users
Added on 7/28/2006
Views 727
Rate it!
Answers:

I find this table from MSDN to be useful to explain differences between shadowing and overriding: The main constraint on overriding is that it needs permission from the base class with the 'overridable' keyword. Shadowing does not require permission of base class.

Criterion Shadowing Overriding
Purpose Protecting against a subsequent base class modification introducing a member you have already defined in your derived class Achieving polymorphism by defining a different implementation of a procedure or property with the same calling sequence
Redefined element Any declared element type Only a procedure (Function or Sub) or property
Redefining element Any declared element type Only a procedure or property with the identical calling sequence1
Accessibility Any accessibility Cannot expand the accessibility of overridden element (for example, cannot override Protected with Public)
Readability and writability Any combination Cannot change readability or writability of overridden property
Keyword usage Shadows recommended in derived class; Shadows assumed if neither Shadows nor Overrides specified Overridable required in base class; Overrides required in derived class
Inheritance of redefining element by classes deriving from your derived class Shadowing element inherited by further derived classes; shadowed element still hidden2





If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
What happens when a C# project has more than 1 Main methods

View Answer
Which of the following explicit type conversion is achieved with out loosing the original data value

View Answer
Which of these operator has the Highest Precedence

View Answer
How do you determine the size required by a Value type on the stack

View Answer
How do you check whether an Object is compatible with Specific Type

View Answer
How do you make CLR enforce overflow checking

View Answer
X=X+1 is equivalent to

View Answer
If we need to compare X to a value 3 how do we do it in C#

View Answer
Which operator is used for TypeCasting

View Answer
Array declaration in C# is done with

View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL C# Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/8991/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.8