Statistics
The Highest Post







Statistics
Count 94
Avg 21.00
Min 21
Max 21
Angualr Top questions

Details



Peter Agyekum When is a constructor called? When an object is created, the compiler makes sure that constructors for all of its subobjects (its member and inherited objects) are called. If members have default constructors or constructors without parameters then these constructors are called automatically, otherwise, parameterized constructors can be called using an initializer list. Note: It is called a constructor because it constructs the values at the time of object creation. It is not necessary to write a constructor for a class. It is because the compiler creates a default constructor if your class doesn't have any.
Related Topics