You are overwriting $d which therefor it no longer has a super class, which you are changing its class and that is why you get the error (I may be wrong, just a theory)
I wasn't saying to run both statements. I meant that executing either statement results in that error. Sorry for any confusion.
Is there any known way to get a fourth level of inheritance?
I know that I could technically use a wrapper, but Torque Script isn't really suited for such a thing.
Example:
$a = new ScriptObject() { class = A; };
$b = new ScriptObject() { superclass = A; class = B; };
$c = new ScriptObject(C) { superclass = A; class = B; };
$d = new ScriptObject() { parent = $c; class = D; };
function D::someMethod(%this, %arg)
{
return %this.parent.someMethod(%arg);
}
But that doesn't quite carry the same effect. I'd have to know every method name, and anyone who extends A, B, or C, would have to know to add a similar wrapper method to D. Not to mention the potential variables used outside of accessors and mutators.
Some languages off a general catch-all method (like PHP's magic __call method), where wrappers are really easy.