Apr-24-2023, 06:22 PM
When you subclass and the superclass has an __init__ method, the subclass needs to call the __init__ method for the superclass. The best way to do that is use super().
class Docent(persoon): def __init__(self, naam, sekse, geboortedatum,*Salaris): super().__init__(naam, seksa, geboortedatum) if(Salaris==None): self.Salaris = "0" else: self.Salaris = SalarisYou are not handling the optional Salaris argument correctly.
class Docent(persoon): def __init__(self, naam, sekse, geboortedatum, Salaris=0): super().__init__(naam, seksa, geboortedatum) self.Salaris = SalarisYour __init__() method made Python think Solaris was a list of positional arguments following geboortedatum when what you really want is an argument where the user has to option of providing an argument value, or using the default value.