a very quick question, let's say I have a template:
template <class T>
class foo {
private:
T SubFoo;
...
};
And then I have things like:
foo < foo < int > > myFoo;
which works great. In this case, myFoo will have a member myFoo.SubFoo, which will be of type foo < int >.
I want to have a pointer in myFoo.SubFoo that points to myFoo. I do not know how to properly call it, a pointer to the SubFoo class, which points to the entire mother class myFoo. Is it possible? I tried to include an ad:
template <class T>
class foo {
private:
...
T SubFoo;
foo< foo < T > >* p2mother;
...
};
But that does not work.
In general, what I am doing is creating a recursive structure. It's very easy to pass a recursive message, but I find the trouble up. Maybe I'm designing it wrong.
Thank you so much!
source
share