Python: How do I make a subclass from a superclass?

后端 未结 11 1812
日久生厌
日久生厌 2020-11-29 19:01

In Python, how do you make a subclass from a superclass?

11条回答
  •  清酒与你
    2020-11-29 19:22

    Subclassing in Python is done as follows:

    class WindowElement:
        def print(self):
            pass
    
    class Button(WindowElement):
        def print(self):
            pass
    

    Here is a tutorial about Python that also contains classes and subclasses.

提交回复
热议问题