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 does console readkey do in c#?
How can I process command-line arguments?
What is Global Assembly Cache (GAC) and what is the purpose of it? (How to make an assembly to public? Steps) How more than one version of an assembly can keep in same place?
What is difference between web and window application?
How many keyword present in C# language ?
What does || mean in programming?
Which is faster hashtable or dictionary?
What are the types of access modifiers?
What is difference between class and interface in c#?
What is the difference between finalize() and dispose()?
Why do we need abstraction in c#?
Which class does the remote object has to inherit?
Define sealed classes in c#?
What is regex c#?
What is an inheritance ?Give an example in which inheritance is used?