in reply to I'm getting some weird error

What error do you get?

What you are doing is not "virtual functions", but using anonymous functions. The subroutine stored in $myFunction does not have a name.

Your syntax for calling the function is wrong/weird:

&$myFunction->()

Most likely you wanted:

$myFunction->()