Inheritance definition with example in C#.Net

Inheritance definition with example

Definition: Acquiring the base class properties in the derived class.

Example:

Class A
{
public void Add()
{
}
}

Class B:A
{
public void Mul()
{
public void
}
}

Main()
{
static void main(string args[])
{
B objB=new B();
objB.Add(); //here B class can get use the method of class A.
}
}

See more inheritance types
Single level inheritance
 Multi-level inheritance
 Multiple inheritance
 Hierarchical inheritance
 Hybrid Inheritance



See more OOPS DOTNET Interview Questions

See more ASP.NET, C#.NET, SQL Server and more Interview Questions




Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar