using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SimpleInheritance
{
class shape
{
public int height;
public int width;
public void setHeight(int h)
{
height = h;
}
public void setWidth(int w)
{
width = w;
}
}
class Area : shape
{
public int getArea()
{
return height * width;
}
}
class Program
{
static void Main(string[] args)
{
Area a = new Area();
a.setHeight(5);
a.setWidth(5);
Console.WriteLine("Area of Rectangle : {0}", a.getArea());
Console.ReadLine();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SimpleInheritance
{
class shape
{
public int height;
public int width;
public void setHeight(int h)
{
height = h;
}
public void setWidth(int w)
{
width = w;
}
}
class Area : shape
{
public int getArea()
{
return height * width;
}
}
class Program
{
static void Main(string[] args)
{
Area a = new Area();
a.setHeight(5);
a.setWidth(5);
Console.WriteLine("Area of Rectangle : {0}", a.getArea());
Console.ReadLine();
}
}
}
Output:
No comments:
Post a Comment