用getnext获取的是成员的一个copy。如果获取成员的指针呢,我想改变Clist成员内部的值,我该怎么做?

解决方案 »

  1.   

    CList::GetNext
    TYPE& GetNext( POSITION& rPosition );
    改变Clist成员内部的值,用上面的引用就可以了!!
    TYPE GetNext( POSITION& rPosition ) const;Return ValueIf the list is const, GetNext returns a copy of the element at the head of the list. This allows the function to be used only on the right side of an assignment statement and protects the list from modification. 
    看这里!!
    If the list is not const, GetNext returns a reference to an element of the list. This allows the function to be used on either side of an assignment statement and thus allows the list entries to be modified.
      

  2.   

    maxcode(zhangjianfang):
    Thank you very much!