Reputation: 111
Should the private methods of a class check if the object is properly initialized even if it's already done by the public methods?
I have an class/object that represents real hardware. What the private methods do can be dangerous if object is not properly initialized. Should these private methods check the initialization status if this is done by the public methods that call those private methods?
Upvotes: 1
Views: 82
Reputation: 753
The private methods should assert that the values are initialised, but they don't need to communicate failures to the caller because that is done by the public methods.
Upvotes: 0