I am trying to write two classes which can access the same base class
as shown in the following code. My problem is when I include these two
classes in the main.cpp, errors pop up saying that the base class is
redefined. Is there anyone who can tell me how to do with it? ( I
still want to have two friend classes of the same baseclass)
thanks
************************************************** *********************************************
baseclass.h:
---------------------------------------
class baseClass
{
private:
static int arrays[2][2];
public:
friend class newClass1;
friend class newClass2;
};
----------------------------------------
newclass1.h:
-----------------------------------------
#include baseclass.h
class newClass1
{
public:
access(baseClass *);
};
--------------------------------------
newclass2.h:
--------------------------------------
#include baseclass.h
class newClass2
{
public:
calcuate(baseClass *);
};
-----------------------------------------------
#include "newclass1.h"
#include "newclass2.h"
Main.cpp:
{
newclass1 mynewclass1;
newclass2 mynewclass2;
......
}