
Patrick B. answered 03/03/20
Math and computer tutor/teacher
using namespace std;
#include <iostream>
class X
{
private:
int x;
public:
X(int X)
{
this->x = X;
cout << "X constructor : x = "<< this->x << endl;
}
~X()
{
cout << "X destructor : x = "<< this->x << endl;
}
int Get() { return(x); }
};
X globalX(5);
int main()
{
//globalX constructor with X=5 will get called first
X localX(3);
// globalX destructor with X=5 will get called last
}