Recent Questions
.Net Framework : What is difference between string and stringbuilder?

What is difference between string and stringbuilder?

String is for simple string operations while StringBuilder is used to perform high manipulation stri....
Category: .Net Framework Date: 7/3/2010 1:55:44 PM
C# : Can we have a variables inside the interface?

Can we have a variables inside the interface?

No, we can have only methods, properties, indexers and enums inside the interface.
Category: C# Date: 7/3/2010 1:54:37 PM
C# : What is static class and what is use of this?

What is static class and what is use of this?

Static class we define when we do not want to create a object of class, all methods of static class ....
Category: C# Date: 7/3/2010 1:54:06 PM
OOPs Concepts : What is difference between overloading and overriding?

What is difference between overloading and overriding?

Having same name methods with different parameters is called overloading, while having same name and....
Category: OOPs Concepts Date: 7/3/2010 1:53:22 PM
.Net Framework : What is difference between Monitor.Enter and Monitor.TryEnter functions?

What is difference between Monitor.Enter and Monitor.TryEnter functions?

Monitor.Enter waits for the lock until it does not get it, while Monitor.TryEnter will request for l....
Category: .Net Framework Date: 7/3/2010 1:52:22 PM
C# Interview Questions and Answers
<< Previous Question Next Question >>
Question: 451 Page Views: 

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



Posted By: Avi Date: 5 February 2010 01:49:08 PM
Answer:

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.


Posted By: eTechPlanet


Date: 5 February 2010 01:49:08 PM

By using inherits keyword v can implement inheritance and only single level, multiple level, and hybrid inheritance is supported in vb.net.


Posted By: Johndecruse


Date: 17 February 2010 02:23:56 AM
Post a better Answer if you have
 
(Will show your Gravatar icon)  
  Country flag

Loading
xJ035F