Implicit parameterless constructor

C# provides a parameterless constructor if the class has no constructor defined.

The Rectangle in the following has no constructors and C# adds Rectangle() to it.


using System;
class Rectangle{
   int Width;
   int Height;
}

class Program
{
    static void Main(string[] args)
    {

        Rectangle r = new Rectangle();
    }
}
w_w__w_._j_a__v___a__2__s.__com_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.