Right now I am using the parameter object class for inheritance like this:
class A():
def __init__(self,p1,p2):
self.p1, self.p2 = p1, p2
class B(A):
def __init__(self,b):
self.p1, self.p2 = b.p1, b.p2
This reduces the absurdity of using code, but not the class code itself. So, I would like to make a C ++ object and pass the parameter object to the initialization list as follows
class A {
int p1,p2;
}
class B : public A {
B(const A& a) : A(a) {}
}
Can I do this in Python? In particular, can I set the attributes of the parent class by somehow calling it __init__inside the child? - from reading "Immersion in Python", I would suggest that I can do this, since the object is already built at the time of the call __init__.
Or maybe there is some other way to implement a parameter object reparator in Python (and I'm just trying to force a C ++ technique)?