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 the uses of namespaces?
How to open a new form on button click in Windows forms?
To allow an element to be accessed using a unique key which .NET collection class is used ?
What is the difference between == and object.equals?
What is the use of delegates in c#?
Value Type and Reference Type Data type in C#?
What is public, private, protected, internal and internal protected?
What is delegates in c#?
What is serialization and deserialization in c# with example?
How can I use .NET components from COM programs?
What is different between Boxing and Unboxing?
Are structs value types or reference types?
How do I create a multilanguage, single-file assembly?
What does exclamation mark mean c#?
Explain the different types of delegates used in c#.