What does the keyword virtual mean in the method definition?

Answer Posted / kiran

Even though the function in base class is declared with
virtual keyword, it is not compulsory that the derived
class must override it.
namespace TestNewOverride
{
class MyBaseClass
{
int a;
public virtual int doubleit()
{
return 2 * a;
}
public MyBaseClass()
{
a = 5;
}
}

class MyDerivedClass:MyBaseClass
{
public static void Main()
{

}
}
}

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is datarelation c#?

461


What does do in c#?

532


Does constructor return any value in c#?

495


What is msil, and why should developers need an appreciation of it if at all?

566


Explain a MSIL ? Why is it appreciated by all developers?

582






without modifying source code if we compile again, will it be generated MSIL again?

481


Why singleton class is sealed in c#?

507


Why do we need ienumerable in c#?

462


what are implementation inheritance and interface inheritance?

511


What is a concrete class in c#?

530


What is a method signature in c#?

508


How does c# generics and c++ templates compare?

467


What is string method in c#?

491


Can you have more than one namespace in c#?

486


Define thread?

574