If I want to override a method 1 of class A and in class b
then how do you declare ?
Answer Posted / sridevi
declare method1 as virtual in classA and then create classB
as derived class of ClassA and override method1 in classB.
class ClassA{
public virtual add();
}
class ClassB:ClassA{
public overrride add(){
console.WriteLine("Im in derived");
}
}
| Is This Answer Correct ? | 10 Yes | 0 No |
Post New Answer View All Answers
Is php easier than c#?
How long has c# been around?
What is the difference between protected and internal in c#?
Difference between type constructor and instance constructor? What is static constructor, when it will be fired? And what is its use?
How we can create an array with non-default values?
Is it possible to inline assembly or il in c# code?
Explain deadlock?
What does console mean c#?
Is c sharp free?
without modifying source code if we compile again, will it be generated MSIL again?
How do I declare inout arguments in c#?
What is option parameter in C#?
What is the use of 'as' Keyword in C# ?
How do you create user defined data types in c#?
What is a console device?