Visibility

We now apply access specifiers to the members of our classes. Access specifiers public and private determine the visibility or accessibility of an object’s attributes and operations to other objects. Before we can begin implementing our design, we must consider which attributes and operations of our classes should be public and which should be private.

Previously, we observed that data members normally should be private and that member functions invoked by clients of a given class should be public. Member functions that are called only by other member functions of the class as “utility functions,” however, normally should be private. The UML employs visibility markers for modeling the visibility of attributes and operations. Public visibility is indicated by placing a plus sign (+) before an operation or an attribute; a minus sign (–) indicates private visibility. Figure 23.1 shows our updated class diagram with visibility markers included. [Note: We do not include any operation parameters in Fig. 23.1. This is perfectly normal. Adding visibility markers does not affect the parameters already modeled in the class diagrams of Figs. 22.1822.21.]

Image

Fig. 23.1. Class diagram with visibility markers.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.29.71