This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes abstract class...help Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "abstract class...help " Watch "abstract class...help " New topic
Author

abstract class...help

Bradley Jordan
Ranch Hand

Joined: Feb 19, 2007
Posts: 42

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

Joined: Feb 28, 2007
Posts: 1707
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


cmbhatt
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2341
I would make the variables in the superclass that need to be used in the subclass protected.
Bradley Jordan
Ranch Hand

Joined: Feb 19, 2007
Posts: 42
thanks that worked...
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: abstract class...help
 
Similar Threads
Stumped, need inspiration.
toString method in vector.
abstract class yet again into arrays..
Program like ATM where person enters amount in dollars and cents but program uses int for monies
Just Can't figure it out and it's due today