I have a parent class named parent and its like this:
class parent(object):
def __init__(self,p1,p2):
super(parent,self).__init__()
self.p1= p1
self.p2= p2
I have another child class that looks like the following:
class child(parent):
def __init__(self,p1,p2,p3):
super(child,self).__init__()
self.p1 = p1
self.p2 = p2
self.p3 = p3
This child class has one extra instance variable called p3. What I am trying to do is have the ability to create objects with parameters. These parameters are used to update both the inherited variables p1 & p2 of class parent and its own instance variables p3. But when I run the above, I get error:
if __name__ == "__main__":
p1 = parent('p1_parent','p2_parent')
p2 = child('p1_child','p1_child','p1_child')
error:
TypeError: __init__() takes exactly 3 arguments (1 given)
super(Event, self)when the class isn'tEvent?Eventdoesn't even appear in the inheritance hierarchy.