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

Get 9,000 Interview Questions & Answers in an eBook.


  • 9500+ Pages
  • 9000 Question & Answers
  • All Tech. Categories
  • 14 MB Content

    Get it now !!


    Send your Resume to 6000 Companies


  • INTERVIEW QUESTIONS MICROSOFT C# DETAILS
    Question :
    What is the difference between shadow and override


    Category C# Interview Questions
    Rating (3.0) By 2 users
    Added on 8/12/2006
    Views 2908
    Rate it!
    Answers:

    Shadowing :- This is a VB.Net Concept by which you can provide a new implementation for the base class member without overriding the member. You can shadow a base class member in the derived class by using the keyword "Shadows". The method signature,access level and return type of the shadowed member can be completely different than the base class member.

    Hiding : - This is a C# Concept by which you can provide a new implementation for the base class member without overriding the member. You can hide a base class member in the derived class by using the keyword "new". The method signature,access level and return type of the hidden member has to be same as the base class member.Comparing the three :-

    1) The access level , signature and the return type can only be changed when you are shadowing with VB.NET. Hiding and overriding demands the these parameters as same.

    2) The difference lies when you call the derived class object with a base class variable.In class of overriding although you assign a derived class object to base class variable it will call the derived class function. In case of shadowing or hiding the base class function will be called.



    There are two main Differences between Shadowing and Overriding.
    1) Overriding redefines only the implementation but shadowing redefines the whole Element.
    2)In Overriding dervied Class can refer the Base class using ME Keyword but in shadowing we can access it using "MYBase".



     Posted by: Praveen Sundar P.V    

    Contact Praveen Sundar P.V  Contact Praveen Sundar P.V


    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 is the top .NET class that everything is derived from?

    View Answer
    C# provides a default constructor for me. I write a constructor that takes a string as a parameter, but want to keep the no parameter one. How many constructors should I write?

    View Answer
    When you inherit a protected class-level variable?Who is it available to?

    View Answer
    Does C# support multiple inheritance?

    View Answer

    How do you inherit from a class in C#?


    View Answer
    What is an abstract class?

    View Answer
    What does the keyword virtual mean in the method definition?

    View Answer
    How's method overriding different from overloading?

    View Answer
    What's the top .NET class that everything is derived from?

    View Answer
    Describe the accessibility modifier protected internal.

    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-2009 CoolInterview.com, All Rights Reserved.
    Privacy Policy | Terms and Conditions
    Page URL: http://www.coolinterview.com/interview/10649/default.asp?cachecommand=bypass


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

    0.45