场景1:
Professor p;
Student s=new Student();
ITeacher t;t=s;//没问题,泛化
p=t;//类型不同,可能出错。场景2:
Professor p=new Professor();
Student s;
ITeacher t=new Student();s=t;//没问题场景3:
Professor p=new Professor();
Student s=new Student();
ITeacher t;p=t;//t没有初始化
Professor p;
Student s=new Student();
ITeacher t;t=s;//没问题,泛化
p=t;//类型不同,可能出错。场景2:
Professor p=new Professor();
Student s;
ITeacher t=new Student();s=t;//没问题场景3:
Professor p=new Professor();
Student s=new Student();
ITeacher t;p=t;//t没有初始化
Professor p;
Student s=new Student();
ITeacher t;t=s;//没问题,泛化
p=t;//类型不同,可能出错。场景2:
Professor p=new Professor();
Student s;
ITeacher t=new Student();s=t;//没问题场景3:
Professor p=new Professor();
Student s=new Student();
ITeacher t;p=t;//t没有初始化
Professor p;
Student s=new Student();
ITeacher t;t=s;//没问题,泛化
p=t;//类型不同,可能出错。场景2:
Professor p=new Professor();
Student s;
ITeacher t=new Student();s=t;//没问题场景3:
Professor p=new Professor();
Student s=new Student();
ITeacher t;p=t;//t没有初始化