视频:毕老师第十天10讲
请问① 如果子类创建对象的话参数里该写什么呢②这样算子类访问父类的私有属性么?
abstract class Worker
{
private String name;
private int age;
Worker(String name,int age)
{
this.name = name;
this.age = age;
}
abstract void work();
}
class Manager extends Worker
{
private int bonus;
Manager(String name,int age,int bonus)
{
super(name,age);
this.bonus= bonus;
}
public void work()
{
System.out.println("work");
}
}
class AboutWork
{
public static void main(String[] args)
{
//请问这里创建子类对象的话参数里该放什么呢??
}
}
如题,谢谢?
|
|