0

xor for__init__ function between superclass and subclass

hey there. the question is about object attributes(self.something) imagine u have a superclass with some attributes. and u have lots of subclasses with different attributes. each subclass needs its own attributes plus the superclass's attributes. the problem is: unlike other functions, __init__ function can't be overwritten by subclass. and even if there is a way to overwrite it, then the superclass's attributes are lost! so how can a subclass have its own attributes plus its superclass's attributes?

2nd Dec 2017, 1:50 PM
Aref moloughi
Aref moloughi - avatar
1 Odpowiedź
+ 1
just try for sub class : def __init__(*args): super().__init__(*args)
10th Dec 2017, 7:36 PM
yuri