Vote count:
0
class Wood { public: enter code hereWood(); enter code hereWood(const Wood&); //copy constructor enter code here~Wood();
private: enter code herestring price; };
Wood::Wood(const Wood& orig) { enter code hereprice(orig.price); //error, why? }
Wood::Wood(const Wood& orig) : price(orig.price) { //rigth
}
If i using the construct initialize and it was correct. But if if using "price(orig.price)" and it will error, why?
asked 58 secs ago
About copy construct
Aucun commentaire:
Enregistrer un commentaire