How constructors are different from a normal member function?

A constructor is different from normal functions in following ways:

  •  Constructor has same name as the class itself
  • Constructors don’t have return type
  • A constructor is automatically called when an object is created.
  • If we do not specify a constructor, C++ compiler generates a default constructor for us (expects no parameters and has an empty body).
Posted on by