It seems that mutator and accessor functions defeat the purpose of making the member variables private. Why is this not so?

What will be an ideal response?


The mutator functions can filter data and control the way data members are set. For
example, you (as class author) can exclude illegal data. With accessor functions you
(as class author) can allow the client to see just the variables you want seen, in the
format in which you want them seen.

Computer Science & Information Technology

You might also like to view...

Which of the following statements offers the best method for ensuring that a database is recoverable in case of corruption?

A) Make a copy of the database before attempting to make changes to the database. B) Avoid using the misspelled names of tables and fields in calculated field expressions. C) Limit the number of queries containing expressions in order to limit the chances of corrupting the database. D) Avoid using too many date arithmetic related functions.

Computer Science & Information Technology

An element with _____ positioning is removed from the normal flow and keeps its position even when the user scrolls.

A. fixed B. relative C. absolute D. static

Computer Science & Information Technology

TCP is a connection-oriented protocol.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

?MANs are almost exclusively ____ networks, and thus capable of supporting data rates into the tens of millions and hundreds of millions of bits per second.

A. ?fiber-optic B. ?copper-wired C. ?twisted-paired D. ?coaxial-cabled

Computer Science & Information Technology