An array of a user defined type with a constructor

BlitzMax Forums/BlitzMax Beginners Area/An array of a user defined type with a constructor

You can override methods and functions:

Type Animal

    Field x = 320
    Field y = 200

    Method MakeNoise ()
        Print "Thwwbbpppttt" ' Default sound...
    End Method

End Type

Type Dog Extends Animal
    Method MakeNoise ()
        Print "Woof"
    End Method
End Type

Type Cow Extends Animal
    Method MakeNoise ()
        Print "Moo"
    End Method
End Type

a:Animal = New Animal
a.MakeNoise
Print a.x
Print a.y

d:Dog = New Dog
d.MakeNoise
Print d.x
Print d.y

c:Cow = New Cow
c.MakeNoise
Print c.x
Print c.y