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
What is wrong with the sample program below?
What is xaml in c#?
What is JIT (just in time)? how it works?
What is razor view in c#?
If the interface in c# only contains the declaration of the methods and we need to define those methods in the class, then why we use the interface?
How do you create partial methods?
What is .net c#?
What is thread in c#?
What is inumerable?
What does assert() do in c#?
What is jagged array in c#?
Which technology is best for desktop application?
Can we have static indexer in c#?
Can hashset contain duplicates c#?
What is assembly and dll in c#?