Memory violation access. Inheritance?

Monkey Forums/Monkey Beginners/Memory violation access. Inheritance?

Panz0r(Posted 2016) [#1]
I'm confused of getting the error.

I have an abstract class with coordinates and getters for them. In descendant classes I redefine Show method, which displays different figures according to the coordinates (mojo).
I have a list of abstract class and add randomly descendant. But if I want to call getter declared in abstract class (obviosly) I simply get such a terrible error. What the reason could be? All I saw at the forums about such error is about invalid folders/files etc.
Thanks!


Goodlookinguy(Posted 2016) [#2]
What's giving the error, your game or the compiler?

If it's your game, try debugging it in the debugger. Follow the call stack trace. There are plenty of reasons for it happenings, especially regarding reflection and files from my own experience. However, those are not the only causes. Sometimes it gets real weird and enters a land of mystery where it can't be debugged in Monkey for some reason and there's no explanation. I've only hit that 2 times. Kinda hoping you didn't get that.

If it's the compiler, there's a "+=", "-=", "/=", "%=", etc. augmented assignment operator bug that can cause it. Edit: I just tested and I think the augmented assignment op bug was fixed actually. Hadn't noticed it since the bug was there for some 3 years.


Panz0r(Posted 2016) [#3]
Thanks for your reply. It's runtime error. And yes it's so much weird. Still trying to fix it but no progress so far.

There is a screenshot:


I look forward to other responses.
Thanks!

UPD: I'm so dumb. I forgot to initialize Object with = new Object(). Can be closed.


Goodlookinguy(Posted 2016) [#4]
I was about to write that trying to access a method from a null object can cause this error for C++ Tool and GLFW Desktop targets. I just assume most people are testing with the browsers more often than not, which doesn't cause this error when doing that.


tiresius(Posted 2016) [#5]
I've done this a bunch of times and it gets me every time... :(


Gerry Quinn(Posted 2016) [#6]
Ah, that explains why I have started to confuse the two errors in my mind - I thought it was just because they are similar errors; hadn't realised that you can get either depending on target.