看书遇到如下问题。
class Doctor{
boolean workAtHosptial;
void treatPatient(){
}
}
class Surgon extends Doctor{
void treatPatient(){}
boolean work;
}
请问,Surgon有几个实例变量?几个方法?
我疑惑继承父类后子类实例变量会增加吗?
实例变量:成员变量也称为实例变量,定义在类中,随对象创建而创建,消失而消失。有默认初始值。