小编use*_*491的帖子

C++用于国际象棋的接口基类数组

我正在追逐圈子中的错误消息,试图弄清楚我如何得到我需要的工作.

我正在制作一个国际象棋游戏,每个西洋棋棋子都是一个类,并且有一个名为Piece的接口类.

Piece.h

class Piece {
public:
    virtual ~Piece() {};
    /*
     * Verifies the move on a per-piece basis. If the move is valid, make the changes on the board and return true, false otherwise.
     *
     * @param b             Reference to the board
     * @param toLocation    Where to move the piece
     * @return bool         If the move is valid
     */
    virtual bool move(Board &b, std::pair<int, int> toLocation) { return false; }

protected:
    Piece(GameData::Color _c) { c = _c; }
    GameData::Color …
Run Code Online (Sandbox Code Playgroud)

c++ oop inheritance interface

2
推荐指数
2
解决办法
608
查看次数

标签 统计

c++ ×1

inheritance ×1

interface ×1

oop ×1