About Virtual functions and their use ?

Answer Posted / belson gnana pradeep

Virtual methods those can be overridden and replaced by sub classes.
When working with virtual methods keep in mind datatype of
an object is used to determine the implementation of
the method to call, rather than the type of the variable
that refers to an object.

In C#, a base class must provide the "virtual" modifier for
any virtual method, and derived classes must provide the
"override" modifier for any overriden method inherited from
a base class.

In VB.NET, a base class must provide the "Overridable"
modifier for any virtual method, and derived classes may
provide the optional "Overrides" modifier for any overriden
method inherited from a base class

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Are c# destructors the same as c++ destructors?

665


Can int be null c#?

607


Explain the difference between // comments, /* */ comments and /// comments?

584


How do I create a delegate/multicastdelegate?

635


What is assembly version series sequence?

628






What is namespace in oops?

573


How do you prevent a method from being overridden in c#?

555


What is the use of nullable types in c#?

575


What is the difference between a field and a property in c#?

568


What is null propagation c#?

587


What is the difference between final finally and finalize in c#?

548


What is the difference between ienumerable and enumerable?

549


What is interpolation in programming?

579


What is msil in c#?

644


What is difference between web and window application?

478