ReferenceCountedObject with forward declaration



I have bidirectional include situation which I solved using forward declaration.
I need the forward declared class A to be ReferenceCountedObject.

The thing is that I can’t use ReferenceCountedObjectPtr Ptr in class B’s header, it won’t compile.

How can I solve this problem?



This should compile for you

struct A; // forward declare

struct B
  ReferenceCountedObjectPtr <A> a;

struct A : ReferenceCountedObject

If you are trying to write inline functions in B that use members of A you will need to put those definitions in the .cpp file.


Thanks man