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 dependency injection in simple words?
What is a console in c#?
Can we inherit sealed class in c#?
What is difference between array and collection?
Is multilevel inheritance possible in c#?
What are the differences between value types and reference types?
What are c# i/o classes? What are the commonly used i/o classes?
What is getenumerator?
What is default value of bool in c#?
Does the system.exception class have any cool features?
What is difference between array and collection in c#?
What is the real use of interface in c#?
Hi to all..I have to create an intranet application on C#.NET windows Application so please please let can you people help me as iam new in .NET and if u have any samples or website address from where i can get sample please let know.
What is assembly version series sequence?
can multiple catch blocks be executed for a single try statement?