Ok. I ll note post all the code not to make things complicated. I have two classes:
I want to do this:Code:class Character { ... Weapon rightHand; ... }; class Weapon : public Item { ... }
If I undestand correctly newb.rightHand will have a copy of w. Thus you will have double the memory for the a Weapon object. Is that bad programming? Would it make more sense having a pointer that will point to the object Weapon instead of copying the whole object?Code:Character newb; Weapon w; newb.rightHand = w;



LinkBack URL
About LinkBacks


