Possible @property compromise

Era Scarecrow rtcvb32 at yahoo.com
Fri Feb 1 22:28:45 PST 2013


On Saturday, 2 February 2013 at 06:04:01 UTC, TommiT wrote:
> What do you suppose would happen if I wrote the following?
>
> struct A
> {
  <snip>
>     static int otherFunction()
>     {
>       C cc;
>       return cc.myMemberFunction();
>     }

  It would refuse to compile as a static function can't point to 
an instance/parent. I'm convinced you should not be able to 
return (or create an instance of) a nested struct outside of it's 
level of control or ability to reference properly.

  Had it not been static on the other hand...

             int otherFunction()

  cc has the same level as c, so the return would be equal to: _a 
+ _b + cc._c


More information about the Digitalmars-d mailing list