ABSTRACT

One of the nice things about inheritance, virtual functions, polymorphism, and arrays of objects is the promise that MATLAB will always find and execute the right function based on the object’s type. Following this to its conclusion, you might get the idea that a cShape

array should be able to hold objects in any combination of

cShape

,

cStar

, and

cDiamond

. In reality, the vectorized implementation inside

cShape

’s group of eight cannot deal with a mixture of types. Vectorized operations rely on every object having exactly the same private structure, and exactly the same type. Therefore, even though

cStar

objects can masquerade as

cShape

objects, with respect to building object arrays, there is definitely a difference.