class Engine():
def start(self):
print("Started")
pass
def stop(self):
pass
class Car():
engine_cls = Engine
def __init__(self):
self.engine = self.engine_cls()
def start(self):
print("Car started")
car = Car()
car.start()
Can someone explain me why cant we use:
class Car():
engine_cls = Engine()
Tried: class Car(): engine_cls = Engine()
And encountered object not callable. Want to understand the difference in using the parenthesis.
self.engine = self.engine_cls()
TypeError: 'Engine' object is not callable