MATLAB Programming/Advanced Topics/Object Oriented Programming

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Object Oriented Programming[edit | edit source]

MATLAB as well as Octave have object oriented capabilities. Yet, technically it is not fully an object oriented language.

An Object Oriented Language(OOL) has three components: 1. Polymorphism 2. Inheritance 3. Encapsulation

Octave can be extended by adding new objects. Those objects can overload the operators like e.g. assignment, slicing, comparison.

While in MATLAB, this can be done with m-script, in Octave new objects are implemented as C++ classes. A simple example of how objects can be added to Octave can be found here.

Struct arrays25%.svg[edit | edit source]

MATLAB classes00%.svg[edit | edit source]