I have the book "Design Patterns, Elements of Reusable Object-Oriented Software", and I've been using the internet. I've boiled down my code to bare minimum.
I don't know why I get the error messages:
Error undefined reference to `InputStrategy::InputStrategy()'
I can post more of the error, but it was just the recipe for target failed, and the subsequent undefined reference being passed in to Input(new BinaryInputStrategy());
Does anyone see why this isn't working?
#include <avr/io.h>
class InputStrategy {
protected:
InputStrategy();
};
class Input {
public:
Input(InputStrategy* is) {
inputStrategy = is;
}
private:
InputStrategy *inputStrategy;
};
class BinaryInputStrategy : public InputStrategy {
public:
BinaryInputStrategy() {}
};
int main(void) {
Input ins = Input(new BinaryInputStrategy());
while (1) {}
}
Aucun commentaire:
Enregistrer un commentaire