using System;
namespace inheritance1
{
class Shape{
protected int width, height;
public void setWidth(int w)
width = w;
}
public void setHeight(int h)
height = h;
class Rectangle : Shape
public int GetArea()
return width * height;
public class ExecRectangle
public static void Main(string[] args)
Rectangle rect = new Rectangle();
Shape shp = new Rectangle();
//Shape instance will access only its methods over here
rect.setWidth(1);
rect.setHeight(2);
Console.WriteLine(rect.GetArea());