#ifndef A_H
#define A_H
#include "B.h"
class A
{
public:
A(B);
};
#endif
B.h
1 2 3 4 5 6 7 8 9 10 11 12
#ifndef B_H
#define B_H
#include "A.h"
class B
{
public:
B(A);
};
#endif
The error that i get is :-
A.cpp
c:\b.h(9) : error C2460: 'A' : uses 'B', which is being defined
c:\b.h(7) : see declaration of 'B'
B.cpp
c:\a.h(9) : error C2460: 'B' : uses 'A', which is being defined
c:\a.h(7) : see declaration of 'A'
In one of the earlier posts got to know that by those ifndef statements duplicate inclusion of files is taken care of.
However, it is a bit odd to have class A be constructible from a B and B constructible from an A, as it seems that A is a B and B is an A (so are they not then the same thing?)