ZScript Function Pointers

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: ZScript Function Pointers

Re: ZScript Function Pointers

by argv » Wed Oct 25, 2017 8:36 pm

You can work around the lack of function pointers like early Java did: with an abstract “event handler” class, and concrete classes that override its method.

Alternatively, you could write a subclass of your button class, which overrides its “button clicked” method to perform the action.

Re: ZScript Function Pointers

by Graf Zahl » Thu Oct 12, 2017 1:11 pm

Not going to happen.

ZScript Function Pointers

by Gutawer » Thu Oct 12, 2017 1:10 pm

So, I realise this probably isn't likely to happen, and there's probably some reason its impossible, but on the off-chance that it is doable, I might as well ask - it'd be nice to be able to store a reference to a function and call it from that reference. For example, I am creating a GUI system using the ZScript menus, and it seems like the most sane way to implement button commands would be through a function pointer that executes the function when the button is clicked.

Top