Can we have the method in drived class with the same name
which is there in base class?
Answer Posted / satya
In C#, derived classes can contain methods with the same
name as base class methods.
*
The base class method must be defined virtual.
*
If the method in the derived class is not preceded by
new or override keywords, the compiler will issue a warning
and the method will behave as if the new keyword were present.
*
If the method in the derived class is preceded with
the new keyword, the method is defined as being independent
of the method in the base class.
*
If the method in the derived class is preceded with
the override keyword, objects of the derived class will call
that method instead of the base class method.
*
The base class method can be called from within the
derived class using the base keyword.
*
The override, virtual, and new keywords can also be
applied to properties, indexers, and events.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Explain About ADO and its objects
Define constructors
What is yield in c#?
Explain the role of Garbage collector and its generations?
What is the meaning of MSIL?
What is static classes?
What is the difference between do and while loop?
What's different between c# and c/c++?
Is a dll an assembly?
What are the types of serialization?
What is the purpose of reserved word using in c#?
Can you put two constructor with the same structure in a class?
What is asax file in c#?
What is the difference between values and reference types?
What is window application in c#?