Advertisement
mikuru_chan

Untitled

Feb 24th, 2020
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. class Car:
  2.     def __init__(self, color):
  3.         self.color = color
  4.         self.other = Other()
  5.         self.other.i_like_color_of_this_car(self)
  6.        
  7. class Other:
  8.     def i_like_color_of_this_car(self, car):
  9.         self.chosen_color = car.color
  10.    
  11.     def show_chosen_color(self):
  12.         print(self.chosen_color)
  13.        
  14. red_car = Car("Red")
  15. red_car.other.show_chosen_color(red_car)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement