//Program demonstrating creation and destruction of automatic, static and global objects.

| |


#include<iostream.h>
#include<conio.h>
#include<string.h>
class typeofobject
{
char msg[30];
public:
typeofobject(char s[1])
{
strcpy(msg,s);
cout<<"Object created: "<<msg<<"\n";
}
~typeofobject()
{
cout<<"Object destroyed: "<<msg<<"\n";
}
};
int main()
{  typeofobject t1("Global");
typeofobject t2("Automatic");
static typeofobject t3("Static");
return 0;
}
<