MATLAB Object-Oriented Programming

(Joyce) #1

Abstract Classes


In this section...
“Abstract Classes” on page 12-91
“Declare Classes as Abstract” on page 12-92
“Determine If a Class Is Abstract” on page 12-93
“Find Inherited Abstract Properties and Methods” on page 12-94

Abstract Classes


Abstract classes are useful for describing functionality that is common to a group of
classes, but requires unique implementations within each class.

Abstract Class Terminology

abstract class — A class that cannot be instantiated, but that defines class components
used by subclasses.

abstract members — Properties or methods declared in an abstract class, but
implemented in subclasses.

concrete members — Properties or methods that are fully implemented by a class.

concrete class — A class that can be instantiated. Concrete classes contain no abstract
members.

interface — An abstract class describing functionality that is common to a group of
classes, but that requires unique implementations within each class. The abstract class
defines the interface of each subclass without specifying the actual implementation.

An abstract class serves as a basis (that is, a superclass) for a group of related subclasses.
An abstract class can define abstract properties and methods that subclasses implement.
Each subclass can implement the concrete properties and methods in a way that supports
their specific requirements.

Implementing a Concrete Subclass

A subclass must implement all inherited abstract properties and methods to become a
concrete class. Otherwise, the subclass is itself an abstract class.

Abstract Classes
Free download pdf