Code crashes in v45c but was working in 45b
Monkey Forums/Monkey Programming/Code crashes in v45c but was working in 45b
| ||
Don't know how this duped, but there ya go. I need to be able to delete posts. :) |
| ||
I get this error when trying to run a program I'm developing: C:/myprog/screen_stats.monkey<7> : Error : Can't create instance of class StatsScreen due to abstract method Method Screen.Update:Void(). Error in compilation! Here's the code: |
| ||
I assume that the Screen class is Abstract and has the Update method declared as an abstract method. That means that you have to provide an implementation in any class that extends Screen. That's not a crash, by the way. It's a compilation error. |
| ||
when you create abstract methods, that method has to be implemented in the extended class. it's something that wasn't working on previous versions of monkey and finally got fixed. |
| ||
Oh, so, basically, I need to create an Update() method for StatsScreen? |
| ||
Yes... If you look in framework.monkey, the Screen class is this: Class Screen Abstract Field name$ = "" Method PreStart:Void() game.currentScreen = self Start() End Method Start:Void() Abstract Method Render:Void() Abstract Method Update:Void() Abstract ... If you extend this class you must have a Start, Render and Update method in your own class. |
| ||
Thanks, therevills! I must have skipped class on that day. :) |