can someone show me a simply class that uses a copy constructor, I cant find any examples in msdn.
Printable View
can someone show me a simply class that uses a copy constructor, I cant find any examples in msdn.
a copy constructor simply makes a copy of another object
it's a very simple example, but it should work.Code://i could be wrong... it's been a long time
class Goldfish {
public:
Goldfish ();
int trait1;
char trait2;
Goldfish (Goldfish& temp) {
trait1 = temp.trait1;
trait2 = temp.trait2;
}
};