Advertisement
albin900

Untitled

Jun 26th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class MyClass:
  2.  
  3.     def __init__(self, somedata):
  4.         print somedata
  5.         self.data = somedata
  6.  
  7.  
  8.     def function(self):
  9.         print self.data
  10.  
  11.     def hey(self, cool):
  12.         self.data = cool
  13. class = MyClass("data1")
  14. class2 = MyClass("unicorn")
  15.  
  16. class.function()
  17. class.hey("hello")
  18. class.function()
  19.  
  20. class2.function()
  21.  
  22. class.hey("yoo")
  23.  
  24. class2.hey("yaya")
  25.  
  26. class.function()
  27.  
  28. class2.function()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement