did you try the code jlou posted? That should work for sure.
Printable View
did you try the code jlou posted? That should work for sure.
Yeah.
This is the output I get:Quote:
Originally Posted by polonyman
That is with gcc (GCC) 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6), which should produce about the same code GCC/MinGW does.Code:nyda, nyda/ $ ./test
Dog Constructor Called
Dog Constructor Called
Rover is 0 years old.
He weighs 0 lbs.
Updating Rover's Age and Weight
Rover is 1 years old.
He weighs 10 lbs.
Fido is 0 years old.
He weighs 0 lbs.
Setting Fido to be the same as Rover
Fido is 1 years old.
He weighs 10 lbs.
BARK!!
BARK!!
Dog Destructor Called
Dog Destructor Called
The destructors should be called in any case, no matter what you do with the objects references.