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
Can an abstract class inherit from another abstract class c#?
Define Final Class in C#
How many bytes is a long c#?
What's difference between constants and static readonly?
List the fundamental oop concepts?
What are the three types of predicates?
Explain the difference between .net and c#?
Can you store different types in an array in c#?
Can we make a Static Constructor Parameterized? Give Reason with your answer
What is the difference between delegates and superdelegates?
Explain the types of errors in c#?
Assembly Code. in Rejester AL. How do Contast Replece( or Change): Bit D3 With Bit D4 and Bit D2 With Bit D5 and Bit D1 With Bit D6 and Bit D0 With Bit D7 I am Not Know Very Well Write English.
What is dynamic dispatch?
What is difference between list and dictionary in c#?
Can fields inside a class be virtual?