Protected Member Variables and Functions

Protected Member Variables and Functions

For access to this article, please select a purchase option:

Buy chapter PDF
(plus tax if applicable)
Buy Knowledge Pack
10 chapters for £75.00
(plus taxes if applicable)

IET members benefit from discounts to all IET publications and free access to E&T Magazine. If you are an IET member, log in to your account and the discounts will automatically be applied.

Learn more about IET membership 

Recommend Title Publication to library

You must fill out fields marked with: *

Librarian details
Your details
Why are you recommending this title?
Select reason:
A Guide to MATLAB® Object-Oriented Programming — Recommend this title to your library

Thank you

Your recommendation has been sent to your librarian.

In trying to bring MATLAB's object-oriented capability in line with conventional object-oriented theory, some areas are easy, some are difficult, and some are like trying to fit a square peg into a round hole. Coercing MATLAB to supply protected visibility fits into the latter category. This is mostly because MATLAB has no organic support for protected visibility. If you apply enough pressure, you can push a square peg through a round hole. Similarly, with a reasonably small increase in complexity, the group of eight can be extended to provide protected visibility. Every class must first include a pair of private functions that support protected variables in the same way get and set support public variables. Next, the child and its parents must exchange a set of function handles corresponding to the set of member functions with protected visibility. The best time to execute this exchange occurs during construction. Finally, the child's member functions must be able to locate and use the appropriate function handles.

Chapter Contents:

  • 23.1 How Protected Is Different from Other Visibilities
  • 23.2 Class Elements for Protected
  • 23.2.1 Protected Functions and Advanced Function Handle Techniques
  • 23.2.2 Passing Protected Handles from Parent to Child
  • 23.2.3 Accessing and Mutating Protected Variables
  • 23.2.4 Calling Protected Functions
  • 23.3 Test Drive
  • 23.4 Summary
  • 23.5 Independent Investigations

Inspec keywords: mathematics computing; object-oriented programming

Other keywords: MATLAB; protected member variables; protected visibility; protected member functions

Subjects: Mathematics computing; Object-oriented programming

Preview this chapter:
Zoom in

Protected Member Variables and Functions, Page 1 of 2

| /docserver/preview/fulltext/books/pc/sbpc001e/SBPC001E_ch23-1.gif /docserver/preview/fulltext/books/pc/sbpc001e/SBPC001E_ch23-2.gif

Related content

This is a required field
Please enter a valid email address