class Worker
{
Worker()
{
System.out.println("调用了Worker的构造函数");
}
Worker(String str)
{
System.out.println("调用了Worker的带参数的构造函数:"+str);
}
}
class Manager extends Worker
{
Manager()
{
System.out.println("调用了Manager的没有参数的构造函数");
}
Manager(String str)
{
System.out.println("调用了Manager的带参数的构造函数:"+str);
}
}
class Chairman extends Manager
{
Chairman()
{
super("Yes!");
System.out.println("调用了Chairman的没有参数的构造函数");
}
}
class ConstructorUse
{
public static void main(String[] args)
{
Chairman cs=new Chairman();
}
}
java不支持多继承,但却是支持多层继承的,Manager继承了Worker,Chairman继承了Manager,那在Chairman中能不能指定调用Worker的任意构造函数呢??该怎么做?不会是super.super吧···· |