
Constructor and Destructor with Static Members 383
Explanation: In the above program, class A is declared with member variable character pointer
and integer x. The class also has constructor, destructor, and member function show(). Before
main(), object a is declared and constructor is executed that initializes the member variables.
The constructor invokes the member function show(). Finally, the destructor is executed.
9.21 CONSTRUCTOR AND DESTRUCTOR WITH STATIC MEMBERS
Every object has its own set of data members. When a member function is invoked, only copy of
data member of calling object is available to the function. Sometimes, it is ...