1、概述
一般情况,动物是抽象的,所以不能被new,比如你在Animal类中定义一个成员方法eat,你不能定义具体内容,比如吃鱼或者吃白菜,因为动物是抽象的。

一个没有方法体的方法,应该定义为抽象方法,而类中如果有抽象方法,该类必须定义为抽象类。
形如下面的定义格式:加abstract修饰符。
🌟🌟🌟 抽象类不能创建对象
2、抽象类的特点

动物类:

猫类:

狗类:

测试类:

3、抽象类成员的特点
代码:
动物抽象类:
猫类:

测试类:
4、案例
代码:
动物类:

猫类:

狗类:

测试类:
