Why do classes use mutator methods?

Why do classes use mutator methods?
A. Allows client to modify the program
B. Allows client to modify/write the private members
C. Allows servers to access all the private data
D. Allows servers to access only protected members
 
Answer: b
Explanation: The client can have rights to access a file and write something to it. This is mandatory to keep the private data updated. Also it is an advantage over the use of hidden class members.
 

Tìm kiếm

Back
Top