classdef MyBase < nelson.mixin.Heterogeneous
| Parameter | Description |
|---|---|
| obj | an object of a class deriving from nelson.mixin.Heterogeneous. |
| Parameter | Description |
|---|---|
| obj | an object that can participate in a heterogeneous array. |
Derive a class from nelson.mixin.Heterogeneous to allow arrays that contain a mix of objects of that class and of its subclasses. Such an array takes the class of the nearest common nelson.mixin.Heterogeneous ancestor of its elements.
Without this mixin, concatenating objects of different classes is an error. With it, related classes sharing a heterogeneous root can be stored together in one array.
classdef Shape < nelson.mixin.Heterogeneous
end
% classdef Circle < Shape ... end
% classdef Square < Shape ... end
% shapes = [Circle(), Square()]; % a Shape array
| Version | Description |
|---|---|
| 2.0.0 | initial version |