Interfaces
- Parent and Child can have attributes
- Tools only has methods
examples/oop/inheritance/interface.py
class Parent: def __init__(self): print('__init__ of Parent') def in_parent(self): print('in_parent') class Tools: def some_tool(self): print('some_tool') class Child(Parent, Tools): def __init__(self): print('__init__ of Child') super().__init__() def in_child(self): print('in_child') c = Child() c.in_parent() c.some_tool() c.in_child()
__init__ of Child __init__ of Parent in_parent some_tool in_child