?
=?ISO-8859-1?Q?Kristoffer_M=F6gle?=
Hello,
I would like to define a class (ListA) which can store elements of
another class (A). The problem is, that I want to use this class (ListA)
inside class A. (See code below.)
Of course I could use void* instead of A* in ListA but I would prefer a
way where do not always have to cast my pointers.
Is there a possibility to realize it (kind of) this way?
Thanks in advance!
Kris
class ListA {
private:
A * head;
public:
bool Add ( A * );
A * operator [] ( unsigned int );
...
};
class A {
public:
ListA * foo;
...
};
I would like to define a class (ListA) which can store elements of
another class (A). The problem is, that I want to use this class (ListA)
inside class A. (See code below.)
Of course I could use void* instead of A* in ListA but I would prefer a
way where do not always have to cast my pointers.
Is there a possibility to realize it (kind of) this way?
Thanks in advance!
Kris
class ListA {
private:
A * head;
public:
bool Add ( A * );
A * operator [] ( unsigned int );
...
};
class A {
public:
ListA * foo;
...
};