Please Help Me About Sub and Super Classes
이전 댓글 표시
Hello, I am trying to learn classes in Matlab here is a basic question. How can I write two classes A and B in order to represent following structur?
My first class is A and second class is B. Let A has two property as p and q and B has also two property as m and n. Moreover, one of class is subclasses of other.
A.p=1;
A.q=2;
B.m=3;
B.n=4;
A.B=B; %Minor question :) which one is a subclass A or B?
%Hence
A.B.m %should be 3
A.B.n %should be 4
댓글 수: 3
per isakson
2013년 5월 16일
Search for "Defining a Subclass" in the help. As far I can judge, you describe an association.
Volkan Kandemir
2013년 5월 16일
편집: Volkan Kandemir
2013년 5월 16일
per isakson
2013년 5월 16일
You have defined A as a subclass of B and the result you see is as documented, i.e. what you should expect.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Construct and Work with Object Arrays에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!