Created
February 18, 2023 07:29
-
-
Save tanarurkerem/30cc5b2566f6f63cdba4e0bf99e38985 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Animal: | |
| def __init__(self): | |
| self.firstname = 'maci' | |
| self.lastname = 'laci' | |
| self.fullname = self.firstname + self.lastname | |
| def __setattr__(self, __name: str, __value: any) -> None: | |
| super().__setattr__(__name, __value) | |
| try: | |
| if __name == 'firstname' or __name == 'lastname': | |
| self.fullname = self.firstname + self.lastname | |
| except: | |
| pass | |
| class Dog(Animal): | |
| def __init__(self): | |
| super().__init__() | |
| self.firstname = 'Bello' | |
| self.lastname = 'Kutyus' | |
| oneDog = Dog() | |
| print (oneDog.fullname) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment