Type Overide

BlitzMax Forums/BlitzMax Programming/Type Overide

BLaBZ(Posted 2010) [#1]
Is there anyway to override a type with the same name?


ziggy(Posted 2010) [#2]
More or less... If the previous type is on a module, all you have to do is create a type with the same name. You can reffer to the module type by using it's complete path (as instance: brl.linkedlist.tlist)


Brucey(Posted 2010) [#3]
No. Why do you think you'd want to try to do this?


Zeke(Posted 2010) [#4]
no and yes.
if type is in module then it is possible.
example:
SuperStrict
Type TStream
	Field a:Int = 1
End Type

Print New TStream.a

this will override original TStream type

also you can override bmax functions

example:
Function Print(text:string)
	brl.standardio.Print "My print function = " + text
End Function

Print("Hello world!")



_Skully(Posted 2010) [#5]
Wouldn't it be better to abstract, extend, and over-ride the methods/functions in the original one?