#include "Lift.h"
#include "Control.h"
class Floor
{
public:
Floor(void);
~Floor(void);
private:
Control control;//to send requests
};
#include "Floor.h"
#include "Lift.h"
class Control
{
public:
Control();
~Control(void);
private:
Floor floor;//to update floor display
Lift lift;//to tell lift what to do
};
#include "Control.h"
class Lift
{
public:
Lift();
~Lift(void);
private:
Control control;//to send requests
};
If you want your classes to use each other, you pretty much need to do something like this using forward declarations and pointers (preferably smart pointers as they make your life easier):
Control manipulates Lift through the Lift public interface and Lift manipulates the array of Floor through the Floor public interface. Any messaging is done that way. Of course, I don't know how your design is set up, so this suggestion may not work without significant changes.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.