Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function Vehicle(wheelNum)
- local Vehicle = {}
- Vehicle.__wheelNum = wheelNum
- function Vehicle:getWheelNum()
- return self.__wheelNum
- end
- return Vehicle
- end
- local function Car(model)
- local Car = Vehicle(4)
- Car.__model = model
- function Car:getModel()
- return self.__model
- end
- return Car
- end
- local newCar = Car('toYODA')
- print(newCar:getWheelNum())
- print(newCar:getModel())
Advertisement
Add Comment
Please, Sign In to add comment