Click to See Complete Forum and Search --> : Passing template class object as parameters


Daren Chandisingh
April 8th, 1999, 03:44 AM
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

April 8th, 1999, 03:58 AM
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.