Again, armed with the knowledge I have been newly given by FlameDuck, I guess this makes sense. Kind of surprised me, though.
Same example, this time overriding method return types.
What I am seeing there is: As long as the overriding method's return type is based on the return type of the method being extended, it can happen. I find it strange that this does not happen with other types that can be converted, like Floats and Ints. (Only with custom types, it appears).
I realize this is really not much over what was already possible, but it saves a lot of typing!
I can't believe I spent a year ignorant of this.
Strict Type MainTypeData Field name:String="MainType" End Type Type ChildTypeData Field name:String="ChildType" Field iamdifferent:String="I am different!" End Type Type MainType Field data:MainTypeData=New MainTypeData Field bleh:Int = 1 Method CreateThis:MainType() Return New MainType End Method End Type Type ChildType Extends MainType Field data:ChildTypeData=New ChildTypeData Field bleh:Float = 7.51 Method CreateThis:ChildType() Return New ChildType End Method End Type Local Main:MainType=New MainType Local Child:ChildType=New ChildType WriteStdout(Main.data.name+" bleh is ") WriteStdout(Main.bleh+"~n") WriteStdout(Child.data.name+" bleh is ") WriteStdout(Child.bleh + "~n") WriteStdout("This is a variable in an object created by the MainType.CreateThis method: " + Main.CreateThis().bleh + "~n") WriteStdout("This is that variable in an object created by the overrided ChildType.CreateThis method: " + Child.CreateThis().bleh + "~n") End
Same example, this time overriding method return types.
What I am seeing there is: As long as the overriding method's return type is based on the return type of the method being extended, it can happen. I find it strange that this does not happen with other types that can be converted, like Floats and Ints. (Only with custom types, it appears).
I realize this is really not much over what was already possible, but it saves a lot of typing!
I can't believe I spent a year ignorant of this.