Create a class that inherits a class and create the initializer
Is there any point in saying thatI believe that the actions described here will be performed without any description at the point of succession. I look forward to hearing from you.python
Because you have overridden (overwritten) the parent class
_init__, only the
_init__ content defined in the child class is executed.Therefore, if you want to define the
_init__ of the child class in the form of adding to the
_init__ of the parent class, you must call the child class side
super().__init__() with this code
AttributeError: 'Greet2' object has no attribute 'hello'
This is because the override no longer runs the parent class
© 2023 OneMinuteCode. All rights reserved.