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

    Exclamation Can't implement vector of CTreeCtrl or CWnd

    Hi,

    I am not able to add an item to a vector of type CTreeCtrl. This applies to an item of type CWnd in general.

    Code:
    vector<CTreeCtrl> v;
    CTreeCtrl obj;
    v.push_back(obj);
    throws an error :

    Error 1 error C2248: 'CObject::CObject' : cannot access private member
    declared in class 'CObject' C:\Program Files\Microsoft Visual Studio
    8\VC\atlmfc\include\afxwin.h 1820


    Vector of strings or other regular items works fine.

    Please let me know if you know the answer to the same.

    Thanks,
    Hemanth

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Can't implement vector of CTreeCtrl or CWnd

    Searching google for "cannot access private member declared in class 'CObject'" will tell you everything you need to know.

  3. #3
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Can't implement vector of CTreeCtrl or CWnd

    Try this as a simplified explanation.

    CTreeCtrl obj1;
    CTreeCtrl obj2;

    obj1 = obj2;

  4. #4
    Join Date
    Oct 2011
    Posts
    1

    Re: Can't implement vector of CTreeCtrl or CWnd

    Quote Originally Posted by GCDEF View Post
    Try this as a simplified explanation.

    CTreeCtrl obj1;
    CTreeCtrl obj2;

    obj1 = obj2;
    hello
    you can,t copy two instance of class directly to each other, see this:
    http://en.wikipedia.org/wiki/Object_copy

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