access icon free fieldnames.m

  • PDF

With subsref and subsasgn, it sets up public as a new category of member variables. In the tailored display function, it struggled to generate the structure-like output because a separate list of public variables is not available. The paper tailors fieldnames as a way to provide that list. The fieldnames function also plugs a leak in encapsulation. The built-in version of fieldnames returns a list of private names, a behavior it cannot tolerate. Tailoring fieldnames also improves the modularity in the group-of-eight implementation. For example, in display we were forced to add public names to the implementation. Other functions in the group of eight also need access to the names. By including a member function that returns the public list, it can reduce the number of places where public names are repeated. Based on its role with structures, a tailored version of fieldnames is the logical place for the list to exist.

Chapter Contents:

  • 6.1 fieldnames
  • 6.2 Code Development
  • 6.3 The Test Drive
  • 6.4 Summary
  • 6.5 Independent Investigations

Inspec keywords: object-oriented programming

Other keywords: subsasgn; group-of-eight implementation; public variable; Matlab; fieldnames; subsref; private name; member variable category

Subjects: Object-oriented programming

Preview this chapter:
Zoom in

fieldnames.m, Page 1 of 2

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

Related content

This is a required field
Please enter a valid email address