如果重要,代码适用于Arduino ......
class Xbee{
public:
Xbee(SoftwareSerial *xbeeSerial, SoftwareSerial *debugPrinter);
};
class localXbee : public Xbee{
public:
localXbee(SoftwareSerial *xbeeSerial, SoftwareSerial *debugPrinter);
void addRemoteXbee(remoteXbee *newBee, byte index);
};
class remoteXbee : public Xbee{
public:
remoteXbee(long AddressLSB, SoftwareSerial *xbeeSerial, SoftwareSerial *debugPrinter);
class xbeeThermostat{
public:
xbeeThermostat(long AddressLSB, SoftwareSerial *xbeeSerial, SoftwareSerial *debugPrinter);
remoteXbee thermoBee;
};
那么当remoteXbee对象在xbeeThermostat对象中时,如何调用localXbee对象中的addRemoteXbee函数?
localXbee coordinator(&xbeeSerial, &debugPrinter);
xbeeThermostat thermostat(0x40BE4864, &xbeeSerial, &debugPrinter);
void setup(){
coordinator.addRemoteXbee(&xbeeThermostat.thermoBee,0);
}
尝试编译时,我收到错误消息: 在''之前预期的初级表达。令牌
答案 0 :(得分:0)
发现了明显的错误:
void setup(){
coordinator.addRemoteXbee(&thermostat.thermoBee,0);
}
感谢帮助人员:)