擅长:python、mysql、java
<p>在Python中,通常不会使用与静态类型化语言完全相同的OOP方法。具体来说,你并不需要一个对象来实现一个特定的接口或者从抽象基类派生等等。相反,该对象只需要能够执行所需的操作。这就是俗称的鸭子打字。如果它走起路来像鸭子,说话像鸭子,那么,不管怎么说,它都是鸭子。在</p>
<p>所以只需决定对象需要什么方法,并确保它们始终具有这些方法。如果希望在系统中的不同参与者之间共享实现,那么可以考虑类继承。但如果不是,那么您也可以实现不相交的类层次结构。在</p>