Beginner Object-Oriented Programming Concepts
Q26 / 100

What is the purpose of a "setter" method?

Correct! Well done.

Incorrect.

The correct answer is A) To provide controlled write access to a private attribute, often including validation

A

Correct Answer

To provide controlled write access to a private attribute, often including validation

Explanation

Setters allow an object's state to be modified while enforcing rules, such as rejecting invalid values.

Progress
26/100