继承
--好处:提高代码的复用性,提高开发效率;--弊端:影响封装
class Father
{
viod show()
{
System.out.println("A");
}
}
class Son extends Father
{
void show()
{
System.out.println("B");//重写父类的show,将里面的方法改变
}
}class Fat--好处:提高代码的复用性,提高开发效率;--弊端:影响封装
class Father
{
viod show()
{
System.out.println("A");
}
}
class Son extends Father
{
void show()
{
System.out.println("B");//重写父类的show,将里面的方法改变
}
}class Fat