I have two simple classes, very simple One is like master table and contains list of pointers to class Two, and class Two contains one pointer to class One. In every class there is function which call methods over pointers, but I am getting error like
error C2027: use of undefined type
---- class One.h"
#include "Two.h"
class One {
public:
list<Two*> something;
void t(){pointer on Two call methods}
};
and
---------class Two.h
class One;
class Two {
public:
One* something;
void t(){pointer on One call methods}
};
How to solve this problem ?
Move your method defenition to
.cppand include the required header with the type defenition.This is required because compiler is not able to generate the code for calling a method of an undefined type