Some programmers prefer not to use protected access because they believe it breaks the encapsulation of the base class. Discuss the relative merits of using protected access vs. using private access in base classes.

What will be an ideal response?

private data members are hidden in the base class and are accessible only through the public or protected member functions of the base class. Using protected access enables the derived class to manipulate the protected members without using the access functions of the base class. If the base-class members are private, the member functions of the base class must be used to access the data. This may result in a decrease in performance due to the extra function calls, yet accessing and modifying private data in this indirect manner helps ensure that the data in the base class remains consistent.

Computer Science & Information Technology

You might also like to view...

If you were creating your own dialog box, which of the following features would be most appropriate beside Number of copies within a Print dialog box?

A) Spin arrow B) Text box C) Check box D) Option button

Computer Science & Information Technology

Match the project requirement terms to the descriptions

I. Functional Specification A. Related to software and hardware capabilities, such as the browser II. Functional Requirements B. Needs imposed by hardware, software, and networking III. Environmental Requirements C. Used to write out program logic using English words IV. Technical Requirements D. Needs people have for the program, both present and future V. Pseudo-Code E. Key requirements and design elements for a project

Computer Science & Information Technology