Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelliao authored Nov 28, 2024
1 parent 807c455 commit daa91f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/books/python/100-oop/30-extend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Cat(Animal):

对于`Dog`来说,`Animal`就是它的父类,对于`Animal`来说,`Dog`就是它的子类。`Cat``Dog`类似。

继承有什么好处?最大的好处是子类获得了父类的全部功能。由于`Animial`实现了`run()`方法,因此,`Dog``Cat`作为它的子类,什么事也没干,就自动拥有了`run()`方法:
继承有什么好处?最大的好处是子类获得了父类的全部功能。由于`Animal`实现了`run()`方法,因此,`Dog``Cat`作为它的子类,什么事也没干,就自动拥有了`run()`方法:

```python
dog = Dog()
Expand Down

0 comments on commit daa91f4

Please sign in to comment.