Stupid question
I know that this may sound stupid(or not) but i got to know:
it is possible to make something like :
1 2 3 4 5 6
|
class Myclass{
protected:
vector<Myclass> myvector;
public:
Myclass();
}
|
i know that functions can be recursive..but i´m not sure about clases??
Last edited on
Yes, you could do that, but only because it is not recursion.
If you had something like:
1 2 3
|
class Myclass {
Myclass x;
};
|
Then that would be illegal because it would be recursive; each Myclass would contain another Myclass which would contain another Myclass...
Thanks a lot
Topic archived. No new replies allowed.