A Guide to MATLAB Object-Oriented Programming

An important facet of parent child inheritance is the child s ability to tailor any function that would otherwise be conveyed from the parent. In Chapters 12 and 13, the child-class functions didn t do anything other than slice and forward. They couldn t do much more than that because the child classes inherited all of their data from the parent. Closely related to member function tailoring is the child s ability to go beyond inheritance by adding private member variables, public member variables, and member functions.
Adding new m-files is straightforward. Adding new public member variables is a little more difficult because additional variable names need to be incorporated in the group-of-eight functions. Supporting these additions is exactly the reason behind the organization of get.m and set.m. In Chapters 12 and 13, these functions contained slice-and-forward sections only. There was no reason to include sections for public or concealed variables because cStar and cDiamond had none. In this chapter, we will add a public variable to cStar and examine the effects on both the implementation and inheritance.
A class can tailor the behavior of almost any built-in function. The group-of-eight functions are a good example of tailoring. We also used the fact that a tailored function can call the built-in version to coerce MATLAB into doing most of the heavy lifting. In Chapters 12 and 13, we examined parent child inheritance and noted that a child class can tailor the behavior of many parent-class functions. Using a...