Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. problem on work with Class CArray [modified]

problem on work with Class CArray [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
23 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Mark Salsbery

    Oh wait, you said percent noob - that would be up! :)

    "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

    I Offline
    I Offline
    Immunity18
    wrote on last edited by
    #21

    hehehe :D thanks god I have you guys here and you fill my big holes in C++ programming

    1 Reply Last reply
    0
    • I Immunity18

      got 2 function ( second is executed inside first one) how i will pass the CArray class? with my code 1 error : error C2664: 'GetDF' : cannot convert parameter 1 from 'class CArray' to 'class CArray' No copy constructor available for class 'CArray' Error executing cl.exe.

      double CAnaktisiDlg::FindDF(CString file , CArray < CString, CString > AFArray)
      {
      		CString LineRead ;
      		CString str7;
      		CString FilePathName;
      		const int sz =100;
      		char buf[sz];
      		FilePathName = m_FolderName + file;
      		ifstream FileText(FilePathName);
      		while(FileText.get(buf,sz))
      		{
      			FileText.get();
      			LineRead = (LPCSTR) buf;
      			GetDFArray(LineRead);
      			GetDF(AFArray);
      	
      		}
      		FileText.close();	
      	return 0.0;
      }
      
      void CAnaktisiDlg::GetDF(CArray < CString , CString > FArray)
      {
      	int nDf=0;
      	int niDF = 0;
      	for ( int i = 0 ; i
      
      S Offline
      S Offline
      Sameerkumar Namdeo
      wrote on last edited by
      #22

      I have read all the above messages....Great!!!! just want to add one thing since the copy constructor for CArray is explict, therefore you are getting this error. error C2664: 'GetDF' : cannot convert parameter 1 from 'class CArray' to 'class CArray' No copy constructor available for class 'CArray' Error executing cl.exe. If constructors are explicit then temporary copies will not be created during parameter passing in function calls.

      1 Reply Last reply
      0
      • I Immunity18

        got 2 function ( second is executed inside first one) how i will pass the CArray class? with my code 1 error : error C2664: 'GetDF' : cannot convert parameter 1 from 'class CArray' to 'class CArray' No copy constructor available for class 'CArray' Error executing cl.exe.

        double CAnaktisiDlg::FindDF(CString file , CArray < CString, CString > AFArray)
        {
        		CString LineRead ;
        		CString str7;
        		CString FilePathName;
        		const int sz =100;
        		char buf[sz];
        		FilePathName = m_FolderName + file;
        		ifstream FileText(FilePathName);
        		while(FileText.get(buf,sz))
        		{
        			FileText.get();
        			LineRead = (LPCSTR) buf;
        			GetDFArray(LineRead);
        			GetDF(AFArray);
        	
        		}
        		FileText.close();	
        	return 0.0;
        }
        
        void CAnaktisiDlg::GetDF(CArray < CString , CString > FArray)
        {
        	int nDf=0;
        	int niDF = 0;
        	for ( int i = 0 ; i
        
        J Offline
        J Offline
        John R Shaw
        wrote on last edited by
        #23

        I am way late, but Mark Salsbery did not use a single C specific word. Every one was C++ specific, as C does not use direct references (a pointer is an indirect reference). Given a choice between a copy and a reference, use a constant reference unless you want the called function to modify the values passed. If a class is not designed to be passed by value (which you are trying to do) then there is probably a good reason.

        INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups