I made a Player class which inherits from Controller class. It's a class for controlling a unit in a game. I get this error with it:
error: undefined reference to 'Controller::Controller()'
I'm not sure what i'm doing wrong here. Does anyone know what goes wrong?
Thanks
This is the code:
controller.h
#ifndef CONTROLLER_H
#define CONTROLLER_H
class Controller;
#include <qDebug>
class Controller
{
public:
Controller();
virtual bool w();
virtual bool a();
virtual bool s();
virtual bool d();
virtual bool space();
private:
};
#endif // CONTROLLER_H
player.h
#ifndef PLAYER_H
#define PLAYER_H
class Player;
#include "controller.h"
#include "view/mainwindow.h"
#include <QString>
class Player : public Controller
{
public:
Player(QString name, MainWindow *window);
// Controller functions
bool w();
bool a();
bool s();
bool d();
bool space();
private:
QString name;
MainWindow *window;
};
#endif // PLAYER_H
player.cpp
#include "player.h"
Player::Player(QString name, MainWindow *window) {
this->name = name;
this->window = window;
}
bool Player::w() {return window->w();}
bool Player::a() {return window->a();}
bool Player::s() {return window->s();}
bool Player::d() {return window->d();}
bool Player::space() {return window->space();}