CS 1112 Lecture Notes - Lecture 25: Multiple Inheritance

57 views1 pages

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.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents