Unhandled Exception:Attempt to call abstract metho

Archives Forums/BlitzMax Bug Reports/Unhandled Exception:Attempt to call abstract metho

mpmxyz(Posted 2010) [#1]
Some days ago I got a strange error message:
"Unhandled Exception:Attempt to call abstract method"

There are two reasons why that message is pointless:
-You have to implement every abstract method before you are able to create Objects of a class. (The method "New" has got a strange behaviour without polymorphism.)
-The error could be detected by the compiler. It shouldn't be a runtime exception.

Here is an example code:



plash(Posted 2010) [#2]
This probably should be in the compiler, but regardless of that:
The New method for each type is always in the context of itself and any types that it derives from. If you were to call Boom() in the New method from 'TExt', it would work fine, because in that context you have implemented the abstract method.

You'll see the same behavior with Fields.
In fact, you can have a field in an extending type that has the same name as a field in its super type, and they will be treated as two entirely separate fields, depending on the context.


ziggy(Posted 2010) [#3]
No bug here, the New method of each class is executed at its own inheritance level, so when you create an instance of a class, you call a chain of all the 'New' methods from the very first class in the inheritance chain, to the last one. That happens only on the New method. Any other method that call Boom from TRuntimeErr would be called at the appropiated inheritance level (except the Delte method).
AFAIK this is to avoid initialization and freeing of objects getting overriden by inheriting classes.