Pointer to a class member

negerns negerns2000 at gmail.com
Mon Aug 20 12:41:16 PDT 2007


I really do not know how to ask this question, so here's some code:

class A {
   char[] _name;
   public this(char[] n) { _name = n; }
   public char[] get() { return _name; }
}

void main() {
   auto a = new A("digitalmars");

   // I wanted a variable here to point to A._name's value
   // and manipulate it and expect the A._name's value to
   // reflect that change. Something like:

   char[] p = a.get();
   p ~= ".com";

   // and excpect a._name's value becomes "digitalmars.com"

}


-- 
negerns


More information about the Digitalmars-d-learn mailing list