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
Why do we override in c#?
In a single .NET DLL how many classes it contains?
What is the difference between writeline and write in c#?
Is c# code is managed or unmanaged code?
how to insert the data from the grid view to database table though button click.pls send the answer to mail id suri1319@gmail.com
What is JIT (just in time)? how it works?
What is a c# delegate?
what is difference between destruct or and garbage collection ?
What is polymorphism and its types in c#?
Does the system.exception class have any cool features?
how to sort an array in c#
What is the use of protected in c#?
What is routing in c#?
Why linq is having select clause at the end?
What is an escape sequence in c#?