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
What is an inheritance ?Give an example in which inheritance is used?
Explain the access modifiers in c#?
Name the control which cannot be placed in mdi?
Why do we need a singleton class?
Can fields inside a class be virtual?
Can we inherit private members of class in c#?
what are nullable types in c#
What is event delegate in c#?
What Is An Interface Class?
What is difference between private and protected?
What are methods c#?
What is oledb in c#?
Is multiple inheritance possible in c#?
What is binding in c#?
What is string concatenation?