ABSTRACT

With the basic implementation behind us, we need to step up to the next level. We want to improve the implementations by making our classes more capable. With

subsref

and subsasgn

, we set up

public

as a new category of member variables. In the tailored display

function, we struggled to generate the structure-like output because a separate list of public variables is not available. In this chapter, we tailor

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 we cannot tolerate.