Consider the class below.
class Car:
def __init__(self, speed):
self.speed = speed
def accelerate(self):
self.speed += 5
Suppose you instantiate a new object of the class, i.e., ferrari = Car(50)
, is there a way to prevent ferrari.speed
from being accessed from outside of the class?
Thanks for any help,
Jack