locked
Passing CListBox as a parameter RRS feed

  • Question


  • Hi,
    How can I pass  CListBox  as a parameter to a function.If I try
    bool function(CListBox table);

    I am getting the error
    2>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxwin.h(1936) : error C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject'
    2>        c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afx.h(551) : see declaration of 'CObject::CObject'

    Cheers,
    Sam
    Monday, May 5, 2008 1:23 AM

Answers



  • Solved.Changed it to bool function(CListBox& table);
    Monday, May 5, 2008 1:47 AM

All replies



  • Solved.Changed it to bool function(CListBox& table);
    Monday, May 5, 2008 1:47 AM
  • sam:

    Yes, classes derived from CWnd cannot be copied, and so cannot be passed by value.
    Monday, May 5, 2008 12:57 PM