Applicazioni della sottoclasse
Sottoclassare le classi incorporate e definire le interfacce
Derivare le classi da classi incorporate per definire tipi di dati specializzati che estendono le operazioni che si possono eseguire su una particolare classe di dati. La sottoclasse eredita i metodi e i comportamenti della classe incorporata e può aggiungere nuovi metodi per eseguire operazioni specializzate.
Argomenti
Gerarchia di classi eterogenee
- A Class Hierarchy for Heterogeneous Arrays
Heterogeneous class hierarchies enable you to form arrays of different, but related classes.
Sottoclassi di tipi incorporati
- Subclasses of MATLAB Built-In Types
Extend MATLAB® built-in classes by deriving from these fundamental data types. - Behavior of Inherited Built-In Methods
Subclass built-in classes to extend the behavior of functions that operate on that type of data. - Use of size and numel with Classes
Thesize
andnumel
functions work with user-defined classes.
Classi di esempio derivate da classi incorporate
- Subclasses of Built-In Types Without Properties
Class can derive from a built-in class without defining properties and new behaviors. - Subclasses of Built-In Types with Properties
Classes that derive from built-in classes and define properties must define array behaviors for those classes. - Enumerations Derived from Built-In Classes
Enumeration classes derived from built-in types inherit behaviors from these types.
Superclassi
- Abstract Classes and Class Members
Use abstract classes to define interfaces that each subclass inherits. - Define an Interface Superclass
Ways to define interfaces for subclasses to implement.