class A: def __init__(self): print 'A()' class B(A): def __init__(self): A.__init__(self) print 'B()' class C(B): def __init__(self): B.__init__(self) print 'C()' c = C()
Cans omeone help me explaining what am I doing wrong here? I`m getting an error like:
B.__init__() TypeError: unbound method __init__() must be called with B instance as first argument (got nothing instead)
Reading from google,i guess,its not good to call __init__ explicit,but i want to print when an object is created,so i can do that only by creating an object inside another object? like composition in c++ ?