Sunteți pe pagina 1din 2

PROGRAM NO

WRITE A PROGRAM FOR DYNAMIC DELETION AND CREATION OF OBJECTS


IN VC++ USING NEW DELETE OPERATOR

#include<iostream.h>
#include<conio.h>
class test
{
int d;
char a;
public:
test()
{
cout<<"Constructor Invoked"<<endl;
a='M';
d=123;
}
~test()
{
cout<<"Destructor Invoked"<<endl;
}
void display()
{
cout<<"d="<<d<<endl;
cout<<"a="<<a<<endl;
}
};
void main()
{

test *T;
T=new test;
T->display();
cout<<"Dynamic creation of objects"<<endl;
delete T;
getch();
}
OUTPUT

S-ar putea să vă placă și