I have two classes, HouseSecurity and HomeOwner. One of the data members of HomeOwner is a pointer to House Security. In my HomeOwner method I'm trying to call a function from HouseSecurity via the pointer, but I can't find a way that I can call it. The line currentSensorState = house.getSensorState() is the one causing me problems. Any ideas? Thanks!
class HouseSecurity : virtual public SecurityStatus{
SensorInfo mySensorStatus;
public:
SensorInfo getSensorStatus();
void setSensorStatus(SensorInfo);
};
class HomeOwner : virtual public IObserver{
SensorInfo currentSensorState; // Current state of sensors
string myName; // Personal information pf HomeOwner
string myPhoneNumber;
string myEmail;
HouseSecurity *house; // HouseSecurity pointer
public:
HomeOwner (string, string, string, HouseSecurity *); // Constructor
void Update(); // Called from Notify function in HouseSecurity class
};
// HomeOwner Method
// HomeOwner constructor
HomeOwner::HomeOwner(string name, string number, string email, HouseSecurity *home){
myName = name;
myPhoneNumber = number;
myEmail = email;
house = home; // pointer to House Security in the system
}
// Checks the status of the sensors and updates each of the
void HomeOwner::Update(){
cout << "test update" << house << endl;
currentSensorState = house.getSensorStatus();
cout << "HomeOwner " << myName << " says that the status of windows 1, 2 and door are " << currentSensorState.getWin1State() << " " << currentSensorState.getWin2State() << " "
<< currentSensorState.getDoorState();
}