我在尝试设置此类时遇到错误找不到符号 - 构造函数Customer。
public class PersonalCustomer extends Customer
{
public PersonalCustomer(String accountNumber, Address address, Name name)
{
super(accountNumber, address);
name = name;
}
}
以下是Customer类。
public abstract class Customer
{
private String accountNumber;
private Address address;
private int balance;
private char customerType;
public Customer(String accountNumber, Address address, char customerType)
{
accountNumber = "";
address = address;
balance = 0;
customerType = ' ';
}
在我出错的地方,任何人都可以帮忙吗?
答案 0 :(得分:7)
Customer
构造函数:
public Customer(String accountNumber, Address address, char customerType)
来自子类的调用只提供两个:
super(accountNumber, address);
答案 1 :(得分:2)
super(accountNumber, address, CustomerType);
Java编译器试图找到带有2个参数的super()
构造函数,但遗憾的是,这些参数不存在。退出时出错!
答案 2 :(得分:2)
注意Customer
的构造函数签名,它有3个参数。
现在,你从PersonalCustomer
的构造函数中调用它只提供2。