如何从基类方法中重写方法调用?

2024-04-29 08:24:46 发布

您现在位置:Python中文网/ 问答频道 /正文

根据docs on inheritance

Derived classes may override methods of their base classes. Because methods have no special privileges when calling other methods of the same object, a method of a base class that calls another method defined in the same base class may end up calling a method of a derived class that overrides it.

怎么会这样?有人能用一个简单的例子来说明这个概念吗?


Tags: ofthedocsbasethatoninheritancemethod