const class

Oleg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Nov 26 05:20:38 PST 2014


Hello. I can't find siple way to realization this behavior:

[code]
class A
{
   A parent;

   void someFunc() const { }

   void parentCall() const
   {
      const(A) cur = this;
      while( cur )
      {
        cur.someFunc();
        cur = cur.parent;
      }
   }
}
[/code]

error: cannot modify const expression cur

how create variable that store const object and can be changed to 
other const object?


More information about the Digitalmars-d-learn mailing list