Microsoft
98-361 · Question #164
You need to allow a consumer of a class to modify a private data member. What should you do?
Sign in or unlock 98-361 to reveal the answer and full explanation for question #164. The question stem and answer options stay visible for context.
Understanding Object-Oriented Programming
Question
You need to allow a consumer of a class to modify a private data member. What should you do?
Options
- AProvide a public function that assigns a value to the data member.
- BCreate global variables in the class.
- CAssign a value directly to the data member.
- DProvide a private function that assigns a value to the data member.
Unlock 98-361 to see the answer
You've previewed enough free 98-361 questions. Unlock 98-361 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
Topics
#encapsulation#access modifiers#setters#data members