Question OOP-ENC-0033
EasyWhy should a constructor validate its arguments?
- A.
To make the class abstract
- B.
Because constructors cannot have bodies
- 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
Why should a constructor validate its arguments?
To make the class abstract
Because constructors cannot have bodies
Sign up free to see the answer and a step-by-step explanation.
So that the object uses less memory
So that every object starts in a valid state