Object characteristics 2: inheritance (1)

1. Inheritance reflects an’ is-a’ relationship between classes.

2. Judge whether dog is an animal? -the dog is an animal, which is obviously established. It is obviously not true that a car is an animal. Parent and subclass.
Example: If an animal is a parent, a dog is a subclass.

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐