//基类
public class Accpteacher {
private String name;
private String school;
public Accpteacher(String myName,String mySchool){
name=myName;
school=mySchool;
}
public void giveLesson(){
System.out.println(知识点讲解);
System.out.println(总结提问);
}
public void introduction(){
System.out.println(大家好!我是+school+的+name+.);
}
}
//派生类
public class Java extends Accpteacher {
public Java(String myName,String mySchool){
super(myName,mySchool);
}
public void giveLesson(){
System.out.println(打开eclip);
super.giveLesson();
}
}
//测试类
public class A {
public void judge(Accpteacher t){
t.introduction();
t.giveLesson();
}
public static void main(String args[]){
A a=new A();
Accpteacher as=new Java(无名氏,wuhan);
a.judge(as);
}
}
本文发布于:2022-10-30 08:47:03,感谢您对本站的认可!
本文链接:http://www.wtabcd.cn/fanwen/fan/78/412328.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |