1

I have a problem with circular include and forward declaration:

I have the following classes:

A.h

class B;

class A{
private:
    B b;
}

A.cpp

#include "B.h"

A():b(){

}

B.h

class A;

class B{

    private:
        const A& a;
        B();
        loadA(const A& a_);

}

B.cpp

 #include "B.h"

 B(){
 }

 loadA(const A& a_){
    a = a_;
 }

The compiler says that in "A.h" the type B is incomplete. Is there a way to implement A and B relation , compiling, without using Pointers?

Thank you

0 Answers0