Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "SmartPointer.h"
- #include <iostream>
- using namespace std;
- int main() {
- SmartPointer<Person> p(new Person("Simon", 20));
- p->Display();
- SmartPointer<Person> n(new Person("Mike", 25));
- n->Display();
- p.swap(n);
- p->Display();
- n->Display();
- cout << *p << endl;
- SmartPointer<Person> q;
- q = p;
- q->Display();
- q = n;
- q->Display();
- q.reset();
- cout << *q << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement