programming-examples/c++/Others/A simple class with member variable, constructor, destructor.cpp
2019-11-15 12:59:38 +01:00

32 lines
442 B
C++

A simple class with member variable, constructor, destructor
#include <iostream>
using namespace std;
class who {
char name;
public:
who(char c) {
name = c;
cout << "Constructing who";
cout << name << endl;
}
~who() {
cout << "Destructing who: " << name << endl;
}
};
who makewho()
{
who temp('B');
return temp;
}
int main()
{
who ob('A');
makewho();
return 0;
}