using System;
class Rectangle
{
double width, height;
public Rectangle(double w, double h)
{
width = w;
height = h;
}
public double area()
{
return width * height;
}
}
using System;
class Progarm
{
public static void Main(String[] args)
{
Rectangle rec = new Rectangle(3.0, 7.0);
Console.WriteLine("The area of the rectangle is: " + rec.area());
}
}
Parameterized Constructor
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment