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 are the string functions in c#?
Define an abstract class?
What is lastindexof c#?
Which is better interface or abstract class in c#?
How does bubble sort work?
What is the difference between // comments, /* */ comments and /// comments?
What is Custom attribute? How to create? If I'm having custom attribute in an assembly, how to say that name in the code?
How many parameters can a method have c#?
Can we create instance of private class in c#?
What is the difference between an integer and int?
What is Assembly. and Describe type of assembly. why most developer happy with private assembly.
What is the difference between array and arraylist c#?
What is unmannaged code and will CLR handle this kind of code or not .
What is difference between code access and role based security?
What are interfaces in c#?