Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/129.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ c++;:将指向对象内对象的指针作为参数传递_C++_Arduino - Fatal编程技术网

C++ c++;:将指向对象内对象的指针作为参数传递

C++ c++;:将指向对象内对象的指针作为参数传递,c++,arduino,C++,Arduino,代码是为Arduino编写的如果这很重要 class Xbee{ public: Xbee(SoftwareSerial *xbeeSerial, SoftwareSerial *debugPrinter); }; class localXbee : public Xbee{ public: localXbee(SoftwareSerial *xbeeSerial, SoftwareSerial *debugPrinter); void addRemoteXbe

代码是为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对象位于XBeeStator对象内部时,如何在localXbee对象中调用addRemoteXbee函数呢

localXbee coordinator(&xbeeSerial, &debugPrinter);
xbeeThermostat thermostat(0x40BE4864, &xbeeSerial, &debugPrinter);

void setup(){
    coordinator.addRemoteXbee(&xbeeThermostat.thermoBee,0);
}
尝试编译时,我收到错误消息: “.”标记之前预期的主表达式发现了明显的错误:

void setup(){
    coordinator.addRemoteXbee(&thermostat.thermoBee,0);
}

感谢大家的帮助:)

您声明了一个函数
dog::findthefood
,但从未定义过它。通过定义和
main
的固定返回,它可以编译:您提供的代码编译得很好(为了链接,您需要为函数提供主体,正如ForceBru所指出的)。请显示重现您的问题的代码,并包括您看到的实际错误消息。“不工作”是世界上最不有用的问题描述。好的,明白了。我是新来的论坛,尝试添加代码作为评论,但没有字符,所以我编辑了原来的帖子。。。