I would like to make some classes and call a method on them, without the need to distinguish them, but I do not know why it fails.
Maybe someone can help me with this?
Code: Select all
#ifndef RUNNABLE_H
#define RUNNABLE_H
#include "Arduino.h"
class Runnable {
public:
virtual boolean loop() = 0;
};
#endif
Code: Select all
#ifndef MOTOR_H
#define MOTOR_H
#include "Runnable.h"
class Motor : Runnable {
private:
public: Motor();
};
#endif
Code: Select all
#include "Motor.h"
Motor::Motor () {
}
boolean Motor::loop() {
Serial.println( "LOOP" );
return true;
}