Advertisement
Guest User

Untitled

a guest
Dec 29th, 2021
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. class main():
  2.     def __init__(self):
  3.         self.x = 'abc'
  4.    
  5. class child(main):
  6.     def __init__(self):
  7.         main.__init__(self) # wywołuje bo potrzebuje self.x z klasy main
  8.         self.y = 'd'
  9.    
  10.     def printer(self):
  11.         print(self.x, self.y) # tu nie umiem sie odwołać do self.y z klasy child.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement