Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Some {
- public:
- Some() {
- }
- int getX() {
- return x;
- }
- private:
- int x = 20;
- };
- int main() {
- int* p = new int;
- *p = 10;
- cout << "p value=" << *p << endl;
- delete p;
- Some* c = new Some();
- *p = 30;
- cout << "p pointer=" << p << " c pointer=" << c << endl;
- cout << "p value=" << *p << endl; //<< " c value=" << *c << endl;
- cout << "x value=" << c->getX() << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement