-
Notifications
You must be signed in to change notification settings - Fork 133
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
Update Game.java #26
base: master
Are you sure you want to change the base?
Update Game.java #26
Conversation
Abstract class ... but it was missing abstract funcs. And if we updated GameObject , we need to update Game too, right?
Not all abstract classes need to have abstract functions. Sometimes you may want to declare a class abstract so it may not be instantiated. He implements the "abstract" functions with an empty value to give the user an option to override them, which is not an uncommon practice. |
@agausmann is correct about my intentions. I've made GameObject abstract mostly to prevent people from instantiating it directly. I haven't specifically declared the methods abstract so you don't need to add a ton of empty methods to a class that really only needs to override one or two of said methods. Unless you have a good reason why I should be doing otherwise, I think I'll keep the code as it is in this case. However, thank you very much for the pull request anyways; I do appreciate people making improvements to the codebase. |
@BennyQBD at least you should add return change - its really very usefful to do stuff like Game.AddObject(...).AddObject(...).AddObject(..) etc, or stuff like return Game.AddObject(...); Oh, btw, show me at least one real example that doesnt use init. I cant think of anything that wont initialize at least variables to default ... Dont say put it in constructor - that wont work with ISeriaziable |
@fhntv24 That's true; you will nearly always need an init() method for initializing variables and such. However, most of the time, library writers give them a default definition. Another example is the WPILib used by my FRC team. It doesnot have abstract init() functions; instead, they have some default behavior like |
Can this be closed? |
But is there any reason to do that instead of making it abstract? Every game that people will reasonably be making with the engine will need to initialise something or other; so why not have it abstract? If you are in the very small minority who don't need it, it won't kill you to have a empty definition at the bottom of your game class, and would be useful for the majority of other users. |
Abstract class ... but it was missing abstract funcs. And if we updated GameObject , we need to update Game too, right?