I have defined the two following classes in two different files:
#include "B.h"
class A {
public:
A() {}
~A() {}
f() {
auto b = new B(this);
}
};
And in another file:
#include "A.h"
class B {
public:
B(A* a) {}
~B() {}
}
But I don't understand the compile error I get:
B.h: error: ‘A’ has not been declared
A.cpp: error: no matching function for call to ‘B(A&)‘
*this);
note: candidate is:
note: B(int*)
note: no known conversion for argument 1 from ‘A’ to ‘int*’
Why is my A class has been converted to int ?!