Introduction to class

using System;
class Rectangle
{
    public int height;
    public int width;
}

using System;
class Program
{
    public static void Main(String[] args)
    {
        Rectangle rec = new Rectangle();
        rec.height = 5;
        rec.width = 7;
        Console.WriteLine("The height of the rectangle is: " + rec.height);
        Console.WriteLine("The width of the rectangle is: " + rec.width);
    }
}

No comments:

Post a Comment