K
Kelvin@!!!
Hi:
im building a template but get some weird error msg.
the code:
------- class Index--------
template<class T> class Index
{
public:
T idx;
Index(T i)
{
idx = i;
}
}
------- main() --------------
void main( void )
{
Index<double> f = index( 1.3 );
}
------compiling error msg---------
'type cast': cannot convert from 'double' to 'Index'
im using vc 2002
how come it's trying convert double to Index???
how should i fix this code??
thnx for any help.
im building a template but get some weird error msg.
the code:
------- class Index--------
template<class T> class Index
{
public:
T idx;
Index(T i)
{
idx = i;
}
}
------- main() --------------
void main( void )
{
Index<double> f = index( 1.3 );
}
------compiling error msg---------
'type cast': cannot convert from 'double' to 'Index'
im using vc 2002
how come it's trying convert double to Index???
how should i fix this code??
thnx for any help.