Your Ad Here

Saturday, June 14, 2008

Multilevel Inhetitance 2

/* C# program to implemmet multi level inheritance.
This program demonstrates how base class constructors are inherited using multilevel inheritance. */

using System;

namespace Inherit
{
class Shape
{
public Shape()
{
Console.WriteLine("Constructor of base class Shape");
}
}
class Polygon : Shape
{
public Polygon()
{
Console.WriteLine("Constructor of Base class Polygon");
}
}
class Quad : Polygon
{
public Quad()
{
Console.WriteLine("Contructor of class Quad");
}
public static void Main(string[] args)
{
Quad obj= new Quad();
}
}
}

//Output

//Constructor of base class Shape
//Constructor of Base class Polygon
//Contructor of class Quad

2 comments:

dd said...

don't put whole programs, jus put the particular code

dd said...

don't put whole programs, jus put the particular code