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
What is xml comments in c#?
Are structs value types or reference types?
In which format you can pass the value in the sleep function?
What are cshtml files?
Differentiate between sqlclient oledb and providers?
What is serialization and deserialization in c# with example?
How do you specify a custom attribute for the entire assembly?
Why c# is type safe?
Is c# different than c++?
Can extension methods access private members?
Explain About ADO and its objects
Describe the overview of clr integration.
What is entity framework c#?
Is c# 8 released?
What is the purpose of a constructor in c#?