www.itechowais.tech




Constructor in OOP | C++ :

  • It is a member function of class.
  • It is always present in Public section of class.
  • It has same name as that of class.
  • It is called automatically when an object of the class is created.
  • It is not returning any value (no return type) even void also.
  • It reserves memory.
  • Constructor is declared as-


class student
{
  private:
    int roll;
    char name[10];
  public:
    student();       // Constructor declaration
};