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


Please Help Members By Posting Answers For Below Questions

What is difference between a function and a method?

484


Is and as in c#?

500


What problem does Delegate Solve?

560


Illustrate the process of code compilation in c#?

517


Is c# lazy thread safe?

479






in object oriented programming, how would you describe encapsulation?

549


Explain the difference between object type and dynamic type variables in c#?

485


What is method in c#?

468


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?

498


Why do we need static in c#?

501


What is winforms c#?

473


What is signature c#?

488


What is difference between Enum and Struct?

547


Explain the process of inheriting a class into another class?

483


How do I simulate optional parameters to com calls?

497