Pointer and Class Member

A function may take a class member as argument, it cannot modify the values of the attributes of the class member. For example, if there is a person class, whose members have attribute hairlength, the following function won't work
cut_hair = function p -> r
                p.hairlength /= 2;
           end
since the function cut_hair will duplicate the argument passed to it and only change the hair_length of the duplicate. If we do want to alter the status of a class member, we can pass a pointer to the class member to the function.
cut_hair = function p -> r
                p >>. hairlength /= 2;
           end
p = person.new();
cut_hair(>>p);



oz 2009-12-22