About Question enthuware.ocajp.i.v7.2.877 :
Moderators: Site Manager, fjwalraven
- 
				Russtam
 - Posts: 9
 - Joined: Fri Dec 04, 2015 11:27 am
 - Contact:
 
About Question enthuware.ocajp.i.v7.2.877 :
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 :
I agreeRusstam wrote:I think its also need to add calculateArea() call to constructor, because after constructing instance data will left inconsistent.
- 
				admin
 - Site Admin
 - Posts: 10443
 - Joined: Fri Sep 10, 2010 9:26 pm
 - Contact:
 
Re: About Question enthuware.ocajp.i.v7.2.877 :
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.
			
			
									
									
						I have updated the constructor to update area as well in any case.
thank you for your feedback!
Paul.
Who is online
Users browsing this forum: Google Adsense [Bot] and 37 guests