"C W" wrote in message
I am new to OOP. I'm a bit confused about the following code.
def __init__(self, time):
self.time = time
time = '6:30'
clock = Clock('5:30')
I set time to 6:30, but it's coming out to 5:30. I guess it's because I
passed in 5:30, so, it's replaced?
In print_time(), the variable 'time' is not the same as the variable
'time', a local variable, is set to '6:30'.
'self.time', an instance variable, is set to '5:30'.
You printed self.time, hence the result.