本帖最后由 波-wang 于 2014-5-5 22:00 编辑
abstract class Student
{
public abstract void study();
public void sleep()
{
System.out.println("躺着睡˯");
}
}
class BaseStudet extends Student
{
public void study()
{
System.out.println("base study");
}
public void sleep()
{
System.out.println("坐着睡˯");
}
}
class AdvStudent extends Student
{
public void study()
{
System.out.println("adv study");
}
}
class DoStudent
{
public void doSome(Student stu)
{
stu.study();
stu.sleep();
}
}
class DuotaiDemo3
{
public static void main(String[] args)
{
DoStudent ds=new DoStudent();
ds.doSome(new BaseStudent());
ds.doSome(new AdvStudent());
}
}
|
|