Question OOP-ENC-0080
HardWhich change best encapsulates a 'status' field that can only move from DRAFT to PUBLISHED to ARCHIVED?
- A.
Use a string field
- B.
Make status public
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Encapsulation question
Which change best encapsulates a 'status' field that can only move from DRAFT to PUBLISHED to ARCHIVED?
Use a string field
Make status public
Sign up free to see the answer and a step-by-step explanation.
Replace setStatus() with publish() and archive() methods that check the current state
Add more getters