-
May 28th, 2008, 02:35 PM
#1
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
-
May 28th, 2008, 02:47 PM
#2
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.
-
May 28th, 2008, 02:52 PM
#3
Re: Can't implement vector of CTreeCtrl or CWnd
Try this as a simplified explanation.
CTreeCtrl obj1;
CTreeCtrl obj2;
obj1 = obj2;
-
April 12th, 2014, 07:48 AM
#4
Re: Can't implement vector of CTreeCtrl or CWnd
Originally Posted by GCDEF
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|