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
Can an int be negative c#?
What is double c#?
Can you declare a field readonly?
Why singleton pattern is used in c#?
How do you escape in c#?
How to find methods of a assembly file (not using ILDASM)?
What is sqladapter c#?
How can I make sure my c# classes will interoperate with other .net languages?
What is type keyword in c#?
what is the difference between convert.tostring() and tostring() functions ?
What is arraylist?
Why do we use interfaces in c#?
What is the use of list in c#?
What is lazy class in c#?
To create a localized application which namespaces are necessary?