Subclass Applications

Subclassing built-in classes and defining interfaces

Derive classes from built-in classes to define specialized data types that extend the operations you can perform on a particular class of data. The subclass inherits the built-in class methods and behaviors and can add new methods to perform specialized operations.

Topics

Heterogeneous Class Hierarchy

A Class Hierarchy for Heterogeneous Arrays

Heterogeneous class hierarchies enable you to form arrays of different, but related classes.

Subclasses of Built-In Types

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

The size and numel functions work with user-defined class.

Sample Classes Derived from Built-in Classes

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.

Representing Hardware with Classes

This example of a class derived from a built-in numeric class inherits useful behaviors.

Enumerations Derived from Built-In Classes

Enumeration classes derived from built-in types inherit behaviors from these types.

Superclasses

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.