OOP Interfaces

BlitzMax Forums/BlitzMax Beginners Area/OOP Interfaces

How much flexibility is there in assigning objects to fields?

Here is a simple example.

Type TPlayer

     field weapon : ?

     method attack()
          weapon.attack()
     end method

End Type


I want to be able to assign weapon any object that implements the attack() method. I don't want my Player type to care what the object is that is being sent the attack() message. I don't want to create a TWeapon type and only be able to assign TWeapons to the weapon field.

Is there a generic type I can type my weapon field to that would accept any type of object?

Does this make sense? Would this be like INTERFACES in java? I think Obj-C has something similar also.

Thanks,
Jim