Skip to content

@nadams810 /stack.cpp
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
stack
#include <iostream>
using namespace std;
class CC
{
public:
int x;
CC() : x(5) { cout << "ctor" << endl; }
CC(const CC& c) { cout << "copy ctor" << endl; }
~CC() { cout << "dtor" << endl; }
};
class C
{
public:
CC * x;
};
void f(C * c)
{
CC cc;
c->x = &cc;
}
int main()
{
C c;
f(&c);
cout << c.x->x << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.