-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support derived classes (Car and Heli/Boat/Tank etc) #40
Comments
|
another example of derivatives: 08D4 CREATE_MENU => Menu 0AAC LOAD_AUDIO_STREAM => AudioStream |
We could add an extra field for Boat extends Car |
Note: classes inheritance is supported in CLEO Redux with the help of classes metadata, e.g. Boat |
Closing as it should be sufficient to use classes metadata. |
To solve the dilemma with derived classes (Car and Heli/Boat/Tank etc) we could add overloaded constructor commands:
00A5 CREATE_CAR
Car.Create: Car
00A5 CREATE_BOAT
Boat.Create(...): Boat
00A5 CREATE_TANK
Tank.Create(...): Tank
00A5 CREATE_HELI
Heli.Create(...): Heli
All four will compile to the same opcode 00A5 but the compiler will become aware of the correct type of the vehicle and the class name. Also the compiler could validate that the correct model id is provided to the constructor (
Boat.Create(#INFERNUS...)
would raise an error).What do you think?
Originally posted by @x87 in sannybuilder/dev#136 (reply in thread)
The text was updated successfully, but these errors were encountered: