我们能用组合,尽量不用继承
Public class person{
Private int age;
Public int GetAge(){
Return this.age;
}
}
Class SuperMan:Person{
Public void SuperPower();
}
而组合是:
Public class SuperMan{
Person person;
Public int GetAge(){
Return person.GetAge();
}
}