OOP Interfaces

BlitzMax Forums/BlitzMax Beginners Area/OOP Interfaces

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Yes and no. Its doable, but it will become far harder, if you TBook is not extended from ITWeapon (if you want it to use as weapon, it should be extended from one, otherwise the design is flawed)


In that case you would be forced to use :Object as type and then:

Type TPlayer

     field weapon:object

     method attack()
          if ITWeapon(weapon) <> null
             ITWeapon(weapon).attack()
          elseif TBook(weapon) <> null
             TBook(weapon).attack()
          endif   
     end method

End Type