Are __properties in C++ Builder passed by reference or by value? ...e.g.
class TMyClass
{
private:
int FMyFoo1;
int GetMyFoo2();
void SetMyFoo2(int AMyFoo2);
public:
__property int MyFoo1 = {read=FMyFoo1, write=FMyFoo1};
__property int MyFoo2 = {read=GetMyFoo2, write=SetMyFoo2};
};
Also, you can add the & operator to __properties, like
__property int &MyFoo = {read=FMyFoo};
but only with the Clang based compilers. What's the meaning behind this?
Remy Lebeau has answered my question in a comment:
Declaring a property like
offers direct access to FMember even though DataType is not declared as a reference. So, if you have a function that takes a DataType& reference as input, and pass PropName to the function, the compiler can still optimize and pass FMember by reference to the function.