
392 Constructors and Destructors
(1) What are constructors and destructors?
(2) Explain the characteristics of construc-
tors and destructors.
(3) Explain constructors with arguments.
How are arguments passed to the con-
structor?
SUMMARY
(1) C++ provides a pair of in-built functions
called constructor and destruc-
tor. The compiler automatically ex-
ecutes these functions. When an object
is created, constructor is executed. The
programmer can also pass values to the
constructor to initialize member variables
with different values. The destructor de-
stroys the object. It is executed at the end
of program when objects ...