C/C++ multiple header file declaration problem
Posted on 2011-02-19
I am using Borland C++ Builder to write an application that uses two Units (translation units) saved as Unit1.cpp and Unit2.cpp with corresponding header files Unit1.h an Unit2.h
Unit1 contains the code for class c1 and Unit2 contains the code for class c2.
The problem I have is that I need to call a public function c2->f1(c1 *) taking a parameter of type
pointer to c1 class; furthermore, the body of c2->f1(c1 *) makes reference to a public member of c1
I have a compilation error due to not being able to #include the header files in each unit such that the c1 and c2 types are defined in time.
How do I get round this wihout multiple declarations ( declaring classes in more than one header ) ?