Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class foo
- {
- int name;
- public:
- foo(void): name(0xF00){};
- ~foo(void){};
- };
- class bar
- {
- foo f1;
- foo *f2;
- public:
- bar(void):f2(new foo()){};
- bar(bar& b){
- f1 = b.f1; *f2=*b.f2;
- }
- ~bar(void){delete f2;};
- bar& operator=(bar& b)
- {
- bar *tmp = new bar();
- tmp->f1 = b.f1;
- *tmp->f2 = *b.f2;
- delete f2;
- return *tmp;
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement