CS 1112 Lecture Notes - Lecture 25: Multiple Inheritance
Document Summary
Syntax for creating a subclass: classdef subclass < superclass. Subclasses inherit the properties and methods of the superclass. Each type of method (public, private, etc) needs its own method keyword with specified access. Protected access allows children of the class to access it without it being publically accessible. The subclass must call the constructor of the superclass varname = varname@superclass(param1, param2, etc. ) If a method in the subclass has the same name as a method in the superclass, matlab will automatically run the version in the subclass on objects of the subclass. The type of the object determines which version of the method is used. To use a method of the parent class that is overridden in a subclass, use methodname@superclass(param) Cell arrays can be used to store objects of different classes. Simple arrays can only be used to store objects of a single type.