MATLAB Object-Oriented Programming

(Joyce) #1

Designing Heterogeneous Class Hierarchies


In this section...
“Creating Classes That Support Heterogeneous Arrays” on page 10-24
“MATLAB Arrays” on page 10-24
“Heterogeneous Hierarchies” on page 10-25
“Heterogeneous Arrays” on page 10-25
“Heterogeneous Array Concepts” on page 10-26
“Nature of Heterogeneous Arrays” on page 10-26
“Unsupported Hierarchies” on page 10-29
“Default Object” on page 10-31
“Conversion During Assignment and Concatenation” on page 10-32
“Empty Arrays of Heterogeneous Abstract Classes” on page 10-32

Creating Classes That Support Heterogeneous Arrays


This topic describes the concepts involved in defining classes that support the formation
of heterogeneous arrays. For information on the concatenation of existing MATLAB
objects, see these topics.


  • “Concatenating Objects of Different Classes” on page 10-18

  • “Valid Combinations of Unlike Classes”


For an example that uses heterogeneous arrays, see “A Class Hierarchy for
Heterogeneous Arrays” on page 20-2.

MATLAB Arrays


MATLAB determines the class of an array by the class of the objects contained in the
array. MATLAB is unlike some languages in which you define an array of object pointers
or references. In these other languages, the type of the array is different from the type of
an object in the array. You can access the elements of the array and dispatch to methods
on those elements, but you cannot call an object method on the whole array, as you can in
MATLAB.

10 Object Arrays

Free download pdf