Programme Defining Constructor and Destructor
#include <iostream.h>
Class Test
{
int a,b,c;
Public:
Test(int x)
{
a=0;
b=0;
c=x;
cout<<"IN Constructor!!";
}
~Test()
{
Cout<<"IN Destructor";
}
Void display()
{
Cout<<"a:-"<<a<<"\n b:-"<<b<<"\n c:-"<<c;
}
}
Void Main()
{
Test ob(10);
ob.display();
}
No comments:
Post a Comment