I have the following problem: I create new object
Foo* foo = new Foo();
Bar* bar = new Bar(*foo);
Constructor for Bar:
Bar(Foo& foo)
:field(foo)
Which effects in calling destructor of foo after Bar constructor, because it is passed by value. Is there any possibility to pass foo by address?
Aucun commentaire:
Enregistrer un commentaire