overload .

Mr.Bingo Bingo at Namo.com
Mon Jun 25 13:37:01 UTC 2018


One can overload assignment and dispatch so that something like

A.x = ... is valid when x is not a typical member but gets 
resolved by the above functions.

Therefore, I can create a member for assignment. How can I create 
a member for getting the value?

A.x = 3; // Seems to get translated in to A.opDispatch!("x")(3)

works but

foo(A.x); // fails and the compiler says x does not exist


I need something consistent with opDot. I am trying to create 
"virtual"(not as in function) fields and I can only get 
assignment but not accessor.





More information about the Digitalmars-d-learn mailing list