dimanche 15 mars 2015

Circular dependency on inheritance in C++


I have already searched a lot on the web, but I haven't found anything that might solve my problem. I have these classes:


File: A.h



#include "B.h"

class A {
...
B method();
}


File: B.h



#include "A.h"

class B : public A {
...
}


I'm getting this error "expected class-name before ‘{’ token" in B class file. I've tried add the class declaration in A.h as well as in B.h, but nothing worked. I guess this is a circular dependency problem. Does anyone could help me?




Aucun commentaire:

Enregistrer un commentaire