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

    Passing template class object as parameters

    I have an object based on a template class. I can't nail the syntax required to pass that object as an argument to my function. Please can someone educate me.

    ---
    CArray<int, int> arrayStaff();
    GetStaffList(iID, arrayStaff);
    ...
    void CReportExtension::GetStaffList(int iID, CArray<int, int> &arrayStaff)
    ---
    D:\Projects\report\report.cpp(2023) : error C2664: 'GetStaffList' : cannot convert parameter 2 from 'class CArray<int,int> (void)' to 'class CArray<int,int> &'
    Context does not allow for disambiguation of overloaded function

    --
    Daren Chandisingh

  2. #2
    Guest

    Re: Passing template class object as parameters

    arrayStaff() is a function taking no arguments and returning a CArray<int,int>.
    Remove the () and arrayStaff becomes an object of type CArray<int,int>, which looks like what your function expects.


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