class Car: def __init__(self, obj): self.color = obj() def showColor(self): return self.color.show() class BMW(Car): def showColor(self): print('bmw') return super().showColor() class Audi(Car): def showColor(self): print('audi') return super().showColor() class Color: def __init__(self): pass def show(self): pass class White(Color): test = '333' def show(self): return 'white' class Red(Color): def show(self): return 'red' car = BMW(White) print(car.showColor()) car = Audi(Red) print(car.showColor())