While testing the new feature of Tabax plugins today, discovered a bug in access modifiers validation.
It is performed only at compile time.
Which means, that if the compiler doesn't know what object the method belogns to, than the validation is skipped.
And you can run protected and private methods from whereever your code is executed.
Here is a simple example: (press cancel in the dialogs, otherwise you will get a RunTime error, because the method pack is not implemented in RunBase)
static void tutorial_AccessModifiersError(Args _args)
runBaseObj = RunBase::makeObject(classNum(RunBase));
dictClass = new SysDictClass(classNum(RunBase));
dictClass.callObject(methodStr(RunBase, promptPrim), dictClass.makeObject());
setInPrompt and promptPrim are both private methods. so they should not be allowed to be called this way.
The same thing can be achived by using DictClass.
The funny thing is:
while writing a test example for this post, I stumbled upon another bug - now it's about the abstract modifier of a class.
You all are probably aware that RunBase is an abstract class and cannot be initialized.
Well, in the example I showed this is done using 2 methods again :)
I guess someone should register these with Microsoft.