If I want to override a method one of class A and in class b then how do you declare?



If I want to override a method one of class A and in class b then how do you declare?..

Answer / Supriya Gupta

To override a method from a base class (Class A) in a derived class (Class B), follow these steps:
1. Derive Class B from Class A using the ':' operator, e.g., 'public class B : A'
2. In Class B, declare the overriding method with the same signature as in Class A, but use the 'override' keyword before the return type.
3. Implement the overridden method.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Sharp Interview Questions

What is the use of system.environment class in c#.net?

1 Answers  


What is the importance of closing an ado.net application?

1 Answers  


What is event sourcing in c#?

1 Answers  


what is main function of alternate teamplate of datalist?

1 Answers  


Why dictionary is used in c#?

1 Answers  


What is .net console?

1 Answers  


How to exclude a property from xml serialization?

1 Answers  


What does the dispose method do with the connection object?

1 Answers  


what is read only and constant

8 Answers   FIC, IBM,


What is thread safe in c#?

1 Answers  


What do you use c# for?

1 Answers  


Explain About Postback

1 Answers   BirlaSoft,


Categories