Re: C++

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 16:20 24/02/2003, you wrote:
Any ideas? I've tried passing a A* in the constructor for B, but the compiler doesn't
realize that A is a class when I try to compile, and complains about no type listed.

I seams to be a circular reference since A needs B and B needs A. This cannot be that
unusual, and has probably been solved before, I just don't know how.

Right now moy only though is to make parent a void* and the cast it to a A* in the
implementation of B. That removes all type checking though and I'd rather not abuse
void pointers like that.

-Thomas
Thomas,

It has been a while since i was at C++, but try the following:

Put both classes into the one h and cpp file, they are used together and should be together.

Then predefine the classes as the top of the header file:
class A;
class B;

Note you can only use the above for creating pointers to the predefined classes.

Regards


Damian Dowling
IT Manager
Pallas Foods Ltd

Phone: + 353 69 20200
Fax: + 353 69 20201
Email: damian-dowling@pallasfoods.com



--
Psyche-list mailing list
Psyche-list@redhat.com
https://listman.redhat.com/mailman/listinfo/psyche-list

[Index of Archives]     [Fedora General Discussion]     [Red Hat General Discussion]     [Centos]     [Kernel]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat 9]     [Gimp]     [Yosemite News]

  Powered by Linux