CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 1999
    Posts
    171

    Studying CTypedPtrArray

    I have managed to input data into my CMyClass derived class and add it to MyArrayOfPtrs which was created from CTypedPtrArray<CObArray, CMyClass*>. Assume CMyClass has 3 CString member vars, say m1, m2, & m3. Once I know the zero-based subscript of the myclass, should I be able to reference a member with []? Such as MyArrayOfPtrs[34].m1????? Or is this asking too much. Thanks to anyone who might offer a little explanation!


  2. #2
    Join Date
    Aug 1999
    Posts
    5

    Re: Studying CTypedPtrArray

    Ok ,
    You can use []. But you can't use like "MyArrayOfPtrs[34].m1?????" because you use CMyClass*. It should be MyArrayOfPtrs[34]->m1. Actually it is the same use of CObArray or CPtrArray but it is type safe. Don't forget to allocate the element before adding the element to the array and to deallocate the element after removing that element from the array.

    Hnin Yu


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured