Suppose I have a class like this:
So bClass is like a pointer to an array of "sub classes" (within aClass). Let's say in my program I initialize and have bClass[0] and bClass[1], and I want to make a class bClass[3] that is a copy of bClass[1]. I tried something like this (does not work):Code:class aClass { char *ptr; // random variable, not important int time; aClass *bClass[5]; public: aClass(); ~aClass(); aClass(const aClass& cpy); // copy constructor };
I've also looked through my textbook and online and saw that I can overload the assignment operator which will act similarly to the copy constructor, but I want to know how to do this with a copy constructor? The actual code is different of course but this is just a simplified view of what I want to do. Thanks!Code:aClass bClass[3](bClass[1]);