I am currently learning about inheritance in my java class. And I can't figure out why I can't use the variable "ID" using super in my subclass. What is wrong with my constructor for the savings class? Also I am not allowed to change the instance variables in account to public.
public class Account
{
private String ID;
private double balance;
private int deposits;
private int withdrawals;
private double service;
/**
* Constructor for objects of class Account
*/
public Account(String IDNumber, double cashBalance)
{
ID = IDNumber;
balance = cashBalance;
deposits = 0;
withdrawals = 0;
service = 0;
}
I get the error "ID has private access in Account"
public class Savings extends Account
{
// instance variables - replace the example below with your own
private boolean active;
/**
* Constructor for objects of class Savings
*/
public Savings(String IDNumber, double cashBalance)
{
super(ID);
super(balance);
active = null;
}