How would you implement inheritance using VB.NET/C#?

Answer Posted / mr vinod kumar

When we set out to implement a class using inheritance, we must first start with an existing class from which we will derive our new subclass. This existing class, or base class, may be part of the .NET system class library framework, it may be part of some other application or .NET assembly, or we may create it as part of our existing application. Once we have a base class, we can then implement one or more subclasses based on that base class. Each of our subclasses will automatically have all of the methods, properties, and events of that base class ? including the implementation behind each method, property, and event. Our subclass can add new methods, properties, and events of its own - extending the original interface with new functionality. Additionally, a subclass can replace the methods and properties of the base class with its own new implementation - effectively overriding the original behavior and replacing it with new behaviors. Essentially inheritance is a way of merging functionality from an existing class into our new subclass. Inheritance also defines rules for how these methods, properties, and events can be merged. In VB.NET we can use implements keyword for inheritance, while in C# we can use the sign ( :: ) between subclass and baseclass.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Diff between web user control and web custom control?

713


Can you set the session out time manually?

578


Which method is used to force all the validation controls to run?

765


How would you enable impersonation in the web.config file?

715


What are session objects?

725


Explain the flow of processing of the request? : asp.net mvc

698


What is Model-View-View Model?

768


Is asp.net still used?

746


Do you know about caching with the datasource controls?

667


What is a web api? Which protocol is used in a web api?

727


What is odata in web api?

763


Describe the application event handlers in ASP.NET?

752


What are the asp.net server side objects?

694


Why session is more secure than cookies?

669


How we implement web farm and web garden concept in asp.net?

724