alias this private?
    js.mdnq 
    js_adddot+mdng at gmail.com
       
    Sat Dec  8 23:05:24 PST 2012
    
    
  
Can it not be possible to use alias this on a private field?
struct Q
    private:
       int _x;
    public:
       alias _x this;
?
Seems to me that one does not always want the user to access the 
internal value that is aliased ;/
Q q;
q._x // error yet q, for all practical purposes is _x, we just 
stop the user from being able to directly access it.
For example, maybe I want to override opAssign on an int. The 
user can get around it by doing q._x. Seems like a bad idea.
    
    
More information about the Digitalmars-d-learn
mailing list