0

Python OOP- Acess a function variable through a class object

I dont know if i formulated my self correctly, but i think its clerer when i do my example: class Spam: def__init__(self,x,y): self.x = x self.y = y def print_egg(self): egg = 7 print(egg) vectore = Spam(4,5) vectore.print_egg So how do i can get a class object to print(egg). I know i could do it much easier in the __init__ function but thats not the point. Thank You for your help z77

19th Mar 2017, 2:30 PM
z77
1 Odpowiedź
0
omg i found my mistake... i forgot the parenthesis after vectore.print_egg. -.-
19th Mar 2017, 2:48 PM
z77