I have Objective-C ++ code that I am trying to get from an Objective-C object to call a method inside a C ++ object. I am very new to Objective-C, so I can do it all wrong.
Example:
@interface KnobClass {
}
-(void)Event;
@end
class DoorClass {
public:
KnobClass * knob;
void start() { knob = [[KnobClass allocate] init]; }
};
class AlarmClass {
public:
void Alert();
};
class HouseClass {
public:
DoorClass door;
AlarmClass alarm;
};
int main() {
HouseClass house;
house.door.start();
return 0;
}
The method is [house.door.knob Event]generated in the event, and I want it to be able to call house.alarm.Alert(). But I am confused how to do it right. Can anyone suggest a way to do this?
source
share