About Question enthuware.ocajp.i.v7.2.877 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
Russtam
Posts: 9
Joined: Fri Dec 04, 2015 11:27 am
Location: Saint-Petersburg
Contact:

About Question enthuware.ocajp.i.v7.2.877 :

Post by Russtam »

I think its also need to add calculateArea() call to constructor, because after constructing instance data will left inconsistent.

Hiar85
Posts: 2
Joined: Wed Jan 03, 2018 9:46 am
Contact:

Re: About Question enthuware.ocajp.i.v7.2.877 :

Post by Hiar85 »

Russtam wrote:I think its also need to add calculateArea() call to constructor, because after constructing instance data will left inconsistent.
I agree

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.877 :

Post by admin »

That would be required if the question were asking you about the invariant i.e. area must be consistent with the length. As of now the question is only about encapsulation.
I have updated the constructor to update area as well in any case.

thank you for your feedback!
Paul.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests