Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > usage of undefined class

Reply
Thread Tools

usage of undefined class

 
 
=?ISO-8859-1?Q?Kristoffer_M=F6gle?=
Guest
Posts: n/a
 
      12-10-2003
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;
...
};

 
Reply With Quote
 
 
 
 
Le Géant Vert
Guest
Posts: n/a
 
      12-10-2003

"Kristoffer Mögle" <(E-Mail Removed)-chemnitz.de> a écrit dans le message de
news: br7674$tpm$(E-Mail Removed)-chemnitz.de...
> 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;
> ...
> };




try this :

class A;

class ListA;

class ListA

{

A *m_pA;

};

class A

{

ListA *m_pListA;

};

should compile fine.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
typeof x == 'undefined' or x == undefined? -Lost Javascript 13 01-31-2007 12:04 AM
undefined vs. undefined (was: new Array() vs []) VK Javascript 45 09-12-2006 05:26 PM
Nested Class, Member Class, Inner Class, Local Class, Anonymous Class E11 Java 1 10-12-2005 03:34 PM
Wrong usage of static_cast: is output undefined or predicted? Alex Vinokur C++ 1 09-27-2004 05:23 AM
undefined behavior or not undefined behavior? That is the question Mantorok Redgormor C Programming 70 02-17-2004 02:46 PM



Advertisments