Escolar Documentos
Profissional Documentos
Cultura Documentos
class name.
It can be defined either inside the class definition or outside the class
definition.
The symbol used to declare an constructor is ( ).
Characterstics of a destructor
Its functions are invoked automatically when objects are
destroyed.
We can have only one destructor in a class
They cannot be overloaded or inherited
It does not return a value
class sample
{ int i, int j;
~sample( )
{ cout<<“Destructing”;
}
public : sample( ){i=0;j=0;}
void memb1(void);
void memb2(void);
};
Q
void sample::memb1(void)
{ sample s1;
}
void sample::memb2(void)
{sample s2;
}
void doc(void)
{sample s3;
}
void main()
{ sample s4;
}