Making Handle a Superclass
이전 댓글 표시
I am trying to make a handle class, but I keep getting an error which says "The class 'handle' is not a superclass of class 'Go_board', as required to invoke a superclass constructor or method."
Here is the code I am trying for my class:
classdef Go_board < handle
properties
Board
end
methods
function obj=Go_board(size)
A = Go_cell();
obj.Board = repmat(A, size);
end
end
end
Also, here is the code for by Go_cell class:
classdef Go_cell
properties
state = char('e');
checked = logical(0);
end
end
I don't understand what is wrong because I thought "< handle" made handle a superclass of Go_board. I appreciate any help.
댓글 수: 1
Jacob Halbrooks
2013년 12월 20일
It looks like you've subclassed from handle correctly. What code do you execute that results in an error?
Also, you might consider using false instead of logical(0), and just 'e' instead of char('e').
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Subclass Definition에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!