Hi everyone, I've been writing this chess program for a class with QT Creator, and I have this error that's telling me I'm not defining a function, even though I thought I did. The error is in the .cpp file, and the function definition is in the .h file. They are as follows:
.h
[#ifndef CHESS_H
#define CHESS_H
#include <QImage>
#include <QMainWindow>
#include <QPaintDevice>
#include <QMouseEvent>
class Chess : public QMainWindow
{
Q_OBJECT
void paintEvent(QPaintEvent*);
void mousePressEvent(QMouseEvent* event);
void mouseReleaseEvent(QMouseEvent* event);
public:
Chess(QWidget *parent = 0);
~Chess();
};
class Piece
{
public:
bool color;
QImage image;
void draw(int x, int y, QPainter* paint);
virtual bool canMove(int startx, int starty, int endx, int endy)=0;
Piece(bool c);
};
class Rook: public Piece
{
public:
Rook(bool c);
bool canMove(int startx, int starty, int endx, int endy)
{
return false;
}
};
class Pawn:public Piece
{
public:
Pawn(bool c);
bool canMove(int startx, int starty, int endx, int endy)
{
return false;
}
};
class Bishop:public Piece
{
public:
Bishop(bool c);
bool canMove(int startx, int starty, int endx, int endy)
{
return false;
}
};
class King:public Piece
{
public:
King(bool c);
bool canMove(int startx, int starty, int endx, int endy)
{
return false;
}
};
class Queen:public Piece
{
public:
Queen(bool c);
bool canMove(int startx, int starty, int endx, int endy)
{
return false;
}
};
class Knight:public Piece
{
public:
Knight(bool c);
bool canMove(int startx, int starty, int endx, int endy)
{
return false;
}
};
#endif // CHESS_H]
I havn't changed the main.cpp file or the .pro file so I doubt either of those are causing any issues. Any help is greatly appreciated!
P.S: Sorry if the code is a bit hard to read as I have literally no idea how to put it up hear in the original format with proper indentation. Sorry!