Skip to content
Advertisement

How to implement abstract classes over mulitple inheritances? [closed]

I have a question on multi level inheritance. I am trying to write classes of the form:

JavaScript

I am not planning on instantiating A B1 or B2. My question is, if this is the correct way to go about this in python? I want to make it clear that Bx are still abstract classes

Advertisement

Answer

Its quite simple. If class A defines some abstract methods, then any other class which inherits from A also inherits these methods. Not need to reimplement as abstract methods.

In your case your Bx classes only need their specialised implementations of eval(). They don’t need func() since they already inherit them.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement