GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Microsoft  >  DotNet

 Print  |  
Question:  Can implement same method name in both baseclass And derived class with different action?



January 01, 2006 05:28:45 #2
 samiksc   Member Since: October 2005    Total Comments: 231 

RE: Can implement same method name in both baseclass A...
 

It is possible to 'override' a method with the same name and parameters and provide a different implementation in a derived class, if the base class declares the method as overridable. (override in C#)

It is also possible to use the 'new' keyword in C# to provide a different implementation of a method which may be or may not be declared as overridable by the base class.

The derived class also may use the same method name as in the base class and provide different parameter list and different implementation which will 'overload' the base class method. Here it is not necessary that the method be declared as overridable in the base class.

     

 

Back To Question