Extending a String Object

BlitzMax Forums/BlitzMax Programming/Extending a String Object

Drey(Posted 2006) [#1]
Type mavString Extends String


I get an error "expected identifier but encountered String"

How can i extend the string class?


Tom(Posted 2006) [#2]
You can't do that with 'String'


Chris C(Posted 2006) [#3]
String is a native type, its a like trying to extend an object marked final, or an array

you could always make your own type that has a string as a field...


Drey(Posted 2006) [#4]
pretty much lame. thanks


Russell(Posted 2006) [#5]
Wouldn't that be '...Extends TString' ?

Russell


Dreamora(Posted 2006) [#6]
Some internal types are not extendable like String, TGadget and a few others
Thats because they only exist as C++ objects but not as real BM objects which is needed for extension.


Grey Alien(Posted 2006) [#7]
I wish there was a TArray to extend as well.


Fetze(Posted 2006) [#8]
I like "Chris C"s idea. Just create your own type with a TArray / String / TGadget attached as Field. I think you can do everything you can do when directly extending.


Drey(Posted 2006) [#9]
just a bit more of a hasile. I rather just extend and use all the methods in parallel.