sanjay555

Untitled

Oct 4th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. class Foo(object):
  2.     '''
  3.    def __init__(self, bar):
  4.        self.bar = bar '''
  5.  
  6.  
  7.     def getBar(self):
  8.         self.bar = input("Enter your bar :")
  9.  
  10.     def printBar(self):
  11.         return self.bar
  12.  
  13.     def updateBar(self):
  14.         print("Original bar is :", self.bar)
  15.         self.bar = "UpdatedBar"
  16.         print("Updating please wait . . .")
  17.  
  18.  
  19. objfoo = Foo()
  20. objfoo.getBar()
  21. print("Original :", objfoo.printBar())
  22. objfoo.updateBar()
  23. print("Updated Original :", objfoo.printBar())
  24.  
  25.  
  26. objfoo2 = Foo()
  27. objfoo2.getBar()
  28. print("Original2 :", objfoo2.printBar())
  29. objfoo2.updateBar()
  30. print("Updated Original2 :", objfoo2.printBar())
Add Comment
Please, Sign In to add comment