Is it possible to do partial inheritance with Python?

后端 未结 4 1325
猫巷女王i
猫巷女王i 2020-12-15 05:34

I\'m creating a class (class0) in Python that is a currently based off of one class (class1); however, I\'d like to inherit from another class as well (class2). The thing ab

4条回答
  •  鱼传尺愫
    2020-12-15 06:13

    Why don't you use composition instead? Have your class keep a reference to the desired object, and delegate to it.

提交回复
热议问题