Note: It is not about Calling a parent method in a child class .super()
I have three classes, let's say Parent, Child1 and Child2. Child1 and 2 both have method Cry() and Parent class has another method e.g. MakeChildrenStopCry() in which Cry() is called. However, Parent class does not have method Cry(). Do I need to define Cry() in the Parent class?
Since I do not have any objects of the parent class and I always use the child classes, I simply created 'empty functions' since the inheritance will just overrule these empty functions with the functions from the Child classes.
def MakeChildrenStopCry(self):
if self.Cry():
self.DoWhateverToStopCry(self)
def Cry(self)
return()
For full sample code you can check this but I think the above should be clear.
This is not causing any problems in my code, I just want to know what is done normally or if it is maybe better to setup my code differently.
.cry()method on otherwise?ageattribute and a specific parent (instance) could very well be 49 years old but they could also very well be almost any other age. Explaining the concepts of classes is really out of scope for SO though.