Wednesday, 7 March 2018

Constructors and Destructors in C++




Constructors

Constructors are special class functions which performs initialization of every object. The Compiler calls the Constructor whenever an object is created. Constructors initialize values to object members after storage is allocated to the object.

class A
{
 int x;
 public:
 A();  //Constructor
};