이 번역 페이지는 최신 내용을 담고 있지 않습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.
서브클래스를 구현하는 방법, 서브클래스에서 슈퍼클래스 메서드를 호출하는 방법, 슈퍼클래스에서 파생될 수 있는 클래스를 제어하는 방법을 알아봅니다.
superclasses | Names of superclasses |
matlab.mixin.Heterogeneous | 이종 배열(Heterogeneous Array) 구성을 위한 슈퍼클래스 |
Hierarchies of Classes — Concepts
Organizing classes into hierarchies facilitates the reuse of code.
Designing Heterogeneous Class Hierarchies
Heterogeneous arrays can contain objects of different class, but all objects in the array must derive from a common superclass.
classdef 라인에서 클래스 이름 다음에 슈퍼클래스를 지정합니다.
클래스 파일의 classdef
라인에 슈퍼클래스를 지정합니다.
서브클래스 메서드는 상속된 슈퍼클래스 메서드를 오버라이드할 수 있습니다. 서브클래스 메서드는 자신이 오버라이드하는 슈퍼클래스 메서드를 호출할 수 있습니다.
Control Sequence of Constructor Calls
Control the order in which MATLAB® constructs objects in class hierarchy.
서브클래스는 상속된 메서드를 수정할 수 있습니다.
Subclasses can modify inherited properties that are abstract or private.
Multiple inheritance can lead to conflicting definitions. All superclasses must be free of conflicts in definition.
Classes can restrict the classes that can derive from it.
Enable both handle and value classes to derive from a specific class.
How to Define Handle-Compatible Classes
Handle compatible classes have applications for mixin and abstract superclasses.
Methods for Handle Compatible Classes
Handle compatible class methods must work with both handle and value objects.
Handle-Compatible Classes and Heterogeneous Arrays
Heterogeneous class hierarchies impose certain restrictions when classes are handle compatible.