Intended or Undocumented Behavior?

samspade

Member
The manual says that: "Structs created [with a constructor] will also support single level inheritance, ie: you can create a struct using a function that inherits the data from another constructor function."

This would seem to imply that a struct cannot inherit from a struct that inherits from a struct However, in code this definitely works. Struct C can inherit from B which inherits from A and have the qualities of A.

Does anyone know if this multi-level inheritance is intended or undocumented behavior?

(part of me wonders if the manual doesn't mean single inheritance or if single level inheritance means single inheritance in certain places but everything I'm familiar with, which is admittedly not much, draws a distinction between single level and multilevel inheritance and single and multiple inheritance where the first refers to how many layers you can have and the second refers to how many direct parents you can have)
 
Last edited:

Nidoking

Member
I find it difficult to imagine how to create a thing of an inheritable type that cannot itself be inherited. (I think Java supports this with final classes and interfaces, but that clearly doesn't apply to GML.) Maybe it just hasn't been tested enough for them to stand behind it?
 

samspade

Member
I hope this is true. Multi-level inheritance is very useful and it would be nice to be able to count on it (not too mention I'm doing a tutorial on struct inheritance and would like to not say the wrong thing).
 

Paskaler

Member
I think what they wanted to say with "single level inheritance" is that a struct can only inherit from a single other struct, and then that parent struct can inherit from another single struct and so on, as opposed to multiple inheritance, such as in C++
 
Top