#include <iostream>
using namespace std;
class helloworld
{
public:
helloworld()
{
cout<<"Constructor is called"<<endl;
}
~helloworld()
{
cout<<"Destructor is called"<<endl;
}
void display()
{
cout<<"helloworld!"<<endl;
}
};
int main()
{
helloworld obj;
obj.display();
return 0;
}
Note: Need to be arranged in compiler after copied
OutPut:
Constructor is called
helloworld!
Destructor is called
helloworld!
Destructor is called