using base keyword

using System;
class Recone
{
    double width, height;
    public Recone(double width, double height)
    {
        this.width = width;
        this.height = height;
    }
    public void show()
    {
        Console.WriteLine("The width and height is: " + width + " " + height);
    }

}

using System;
class Rectwo : Recone
{
    public Rectwo(double w, double h):base(w,h)
    {
        
    }
}

using System;
class Program
{
    public static void Main(String[] args)
    {
        Rectwo rt = new Rectwo(5.0, 7.0);
        rt.show();
        Console.ReadKey();
    }
}

No comments:

Post a Comment