Types B3D

BlitzMax Forums/BlitzMax Beginners Area/Types B3D

Yue(Posted 2015) [#1]
Hi, I'm trying to understand the change of Blitz3D to BMX, mcuho I can not understand because I do not speak English for documentation. Someone can give me a simple example please well explained?

; B3D
Type message
   Field caption$
End Type

Local m.message = new message
m.message\caption$ = "Hello"
Print m.message\caption$
Delete m.message



Yasha(Posted 2015) [#2]
' BlitzMax
Type message
    Field caption:String
End Type

Local m:message = new message
m.caption = "Hello"
Print m.caption


So:
-- some minor changes in which symbols are used (`.` -> `:`, `\` -> `.`, etc.) to make it look more like other modern languages
-- uniform type tag notation for builtin types (`:Int`, `:Float` etc. are allowed)
-- type tags are no longer allowed within field-access expressions - only on declarations (note: you didn't need them in B3D either, good style is to leave them off for both languages anyway)
-- Delete no longer exists, no need to delete anything

It's optional, but you should also place a Strict or SuperStrict declaration at the top of your code. Otherwise BlitzMax does strange things and sometimes tries to convert objects to ints, which is unnecessary and confusing.


Yue(Posted 2015) [#3]
Thank you.

How can you approach this to OOP. For example inheritance, polymorphism, where I can find examples of this?


TomToad(Posted 2015) [#4]
This tutorial has a lot of good information.
http://www.blitzbasic.com/Community/posts.php?topic=59233

The link to the file is dead, but you can get the files from this post.
http://www.blitzbasic.com/Community/post.php?topic=59233&post=1173462


Yue(Posted 2015) [#5]
@Tom Toad.
Thanks You :)