I have this class:
TMyClass = class
public
function DoSomethingNice(const Value: string = 'Yes please!'): Boolean;
end;
Now, using RTTI, is it possible to get default value of parameter Value of method DoSomethingNice? if so, how?
I'm mostly interested in a D2010 solution, but XE will do also.
it is impossible, because RTTI has not information about default parameters. default parameter values are used only at compile time
so, if we have...
procedure test(x : integer = 3)
and then call method without parameter value:
test()
then it will be compiled as test(3)
to check this you can open CPU window in debugger:
and test()
looks like
mov eax, $00000003
call test