Re: circular dependencies and typedefs

From: David Harmon (source_at_netcom.com.invalid)
Date: 07/07/04


Date: Wed, 07 Jul 2004 17:09:18 GMT

On Wed, 07 Jul 2004 16:12:55 +0100 in comp.lang.c++, Dylan
<spaldeen@ontheball.com> wrote,
>Is there a way of declaring the following without making A::m_b a
>pointer or a reference?

(example snipped)

Yes. Class A has a member B, so it needs #include "B.h" before the
class A definition and not just a forward declaration of B.

B has only indirect mention of A, so the forward declaration works
there. Of course if B tried to contain a member A, you would have an
impassability.



Relevant Pages

  • Re: Forward references and recursion
    ... It needs not only the name, but it need to know the declaration, to calculate ... A workaround, is to change the member as the pointer to the list, ... Probably you needs just a outside lists of plain data classes, ...
    (microsoft.public.vc.stl)
  • Re: Class members, pointers or not?
    ... > Is it best to declare class member objects as pointers or not pointers? ... using pointer members (and reference members) ...
    (comp.lang.cpp)
  • Re: tracking reference in native class
    ... I did not see interior_ptr in your example, just regular pointer to ... which I "successfully" converted to reference to handle ... assert (a!= nullptr); ... Simple changes, like making "a" a member of a class, ...
    (microsoft.public.dotnet.languages.vc)
  • Re: error C2248: a derived class f() cant access its base class protected member through a pointer?!
    ... > directly but can't access the very same member through a pointer! ... reference to, or object of the derived class itself (or any class ...
    (microsoft.public.vc.language)
  • Re: Variable declaration syntax
    ... I've printed out your post for later reference. ... This part of C's declaration syntax borders upon insanity. ... down with the additional "declaration mimics use" paradigm. ... first pointer, or passing a itself? ...
    (comp.lang.c)