Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

abstract class...help

 
Bradley Jordan
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

that is my abstract code;
here is my subclass checking:

I am trying to complie that but getting this error:
accBalance has private access in Account
return ((accBalance - 700)* .02)* intrestPeriod; how do I get around this. I am only allowed to have the computeIntrest method take one integer arugment and return a double? I can add another variable to the method but that would violate the rule.
can anybody help with this?
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jordon,



take accountbalance using the getter method. It is the proper
way, you can't access private variables of your parent class.


Regards,
cmbhatt
 
Keith Lynn
Ranch Hand
Posts: 2399
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would make the variables in the superclass that need to be used in the subclass protected.
 
Bradley Jordan
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks that worked...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic