Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import multiprocessing
- import time
- class Car:
- color = None
- def __init__(self):
- self.color = "green"
- def changeColor(self, color):
- self.color = color
- def getColor(self):
- return self.color
- car1 = Car()
- def carshop():
- car1.changeColor("red")
- print(car1.getColor())
- th = multiprocessing.Process(target = carshop, args=())
- th.start()
- time.sleep(2)
- print(car1.getColor())
- red
- green
- red
- red
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement