I already have this class
class sensor : iElectronicParts{
// Some stuff here like methods and properties
};
For accessing all sensors I want to store them in a new object with type of global
, so I just coded this class (there's no set
method because I already ran into an error)
class global {
public:
sensor getSensors() {
return sensors; // This line throws the error
}
private:
sensor sensors[10];
};
and I got this error message
Compiling sketch...
/tmp/538691267/200119_Growbox/200119_Growbox.ino: In member function 'sensor global::getSensors()':
/tmp/538691267/200119_Growbox/200119_Growbox.ino:335:12: error: could not convert '((global*)this)->global::sensors' from 'sensor [10]' to 'sensor'
return sensors;
^~~~~~~
exit status 1
I did not instantiated this object yet, I only defined the class. If I replace every type definition of sensor
by int
it works.
Could someone please tell me what I'm doing wrong / what I have to do to fix this?