Constructor

  • Note

    What is a constructor

    Constructor is a special method of a class, which is called automatically when the instance of a class is created.

    Features of a constructor

    1. Constructors do not have any return type

    2. It is not mandatory to declare a constructor

    A class can not inherit the constructor of its base class.