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 are reflections in c#?
How do I run a cshtml file?
How many types of collections are there in c#?
How do I get deterministic finalization in c#?
What is the difference between dynamic and var in c#?
What is a property in c#?
Why do we overload constructors?
Is object an int c#?
What is the difference between ienumerable and iqueryable?
Explain how obfuscator works in .net
Why do you need boxing in c#?
What do you mean by saying a "class is a reference type"?
What are the 3 types of comments in c#?
What is virtual class in C#?
What is namespace c#?