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 difference between a function and a method?
Is and as in c#?
What problem does Delegate Solve?
Illustrate the process of code compilation in c#?
Is c# lazy thread safe?
in object oriented programming, how would you describe encapsulation?
Explain the difference between object type and dynamic type variables in c#?
What is method in c#?
Suppose you have already existing application with Visual Studio 6 (VB 6, InterDev 6) and this application utilizes Windows 2000 COM+ transaction services. With this example how can you approach migrating this application to .NET?
Why do we need static in c#?
What is winforms c#?
What is signature c#?
What is difference between Enum and Struct?
Explain the process of inheriting a class into another class?
How do I simulate optional parameters to com calls?