Microsoft KB Archive/98602

= INFO: Adding a CObList Object to Another CObList =

Article ID: 98602

Article Last Modified on 11/21/2006

-

APPLIES TO

 Microsoft Foundation Class Library 4.2, when used with:  Microsoft Visual C++ 6.1

 Microsoft Visual C++ 6.0 Professional Edition

 Microsoft Visual C++ 6.0 Enterprise Edition

 Microsoft Visual C++ 5.0 Learning Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q98602

<div class="notice_section">

1.00 1.50 1.51 1.52 | 1.00 2.00 2.10 4.00 WINDOWS | WINDOWS NT kbprg

<div class="notice_section">

When the parameter to the AddHead or AddTail member functions of CObList specifies a pointer to an object derived from CObList, the functions add all the items specified in the argument object to the list. To add the CObList object to the list, the application must cast the CObList pointer to a CObject pointer.

In the CObList class, the AddHead and AddTail functions accept either a &quot;CObject *&quot; or a &quot;CObList *&quot; argument. When the functions receive a &quot;CObList *&quot;, the functions add all the items in the specified list to the list. To add the list object to another list, cast the list pointer to a CObject pointer. The following sample code demonstrates the differences between these methods.

Sample Code
// adds all of the CObject items contained in listSrc to listTarget listTarget.AddTail(&amp;listSrc);

// adds listSrc as a CObList object to listTarget listTarget.AddTail((CObject *)&amp;listSrc);

<div class="summary_section">

SUMMARY
Additional query words: kbinf 1.00 1.50 2.00 2.10 2.50 2.51 2.52 3.00 3.10 4.00

Keywords: kbcollectionclass kbinfo KB98602

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.