matlab - 无法实例化派生的 MATLAB 类而不会出错
问题描述
每当我尝试实例化我的 Pawn 类时,都会出现错误。“使用 Pawn 时出错,无法在类 'Pawn' 中定义属性 'AvailMoves',因为该属性已在超类 'ChessPiece' 中定义。”
classdef (Abstract) ChessPiece
properties (Abstract)
AvailMoves;
value;
white;
position;
row;
column;
end
end
classdef Pawn < ChessPiece
properties
AvailMoves;
value;
white;
position; %position is a 1 by 2 vector with the piece's position on the board
hasMoved;
row;
column;
end
methods
function obj = Pawn(position,white)
%UNTITLED3 Construct an instance of this class
% Detailed explanation goes here
obj.hasMoves = false;
obj.white = white;
obj.position = position;
obj.row = position(1);
obj.column = position(2);
obj.AvailMoves = {};
obj.value = 1;
end
end
end
解决方案
推荐阅读
- css - 在具有几个默认值的 CSS 变量的 calc() 上发布 CSS 解析错误
- reverse-engineering - 使用 Angr 在基本块中查找字符串
- msix - AppInstaller 在将 MainBundle 指向 HTTPS URI 时失败,但在指向 FILE:/// URI 时有效
- scala - 通过在 scala 中消费来自 kafka 生产者的 Spark 流
- java - JPype ImportError:找到了类`MyClass`,但不是预期的(!?)
- google-apps-script - 无需用户干预即可从 Imgur API 获取访问令牌
- prolog - Prolog:计算列表中的原子
- r - 错误:clang-10:错误:链接器命令失败,退出代码为 1 || 使用 Python 和 R 在 Anaconda 环境中安装 Rattle 失败
- asp.net - 日志没有使用 Log4Net 登录到类库中
- flutter - 颤振可点击的 ListWheelView 跳转到错误的索引