I would appreciate some help with template overloading
This is a multi-part message in MIME format.
------=_NextPart_000_001C_01C7070A.8C2BB310
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
headerfile.hpp
typedef unsigned short int doublebyte;
typedef class ptr_array< char>* char_ptr_array_ptr;
typedef class ptr_array< int>* int_ptr_array_ptr;
typedef class ptr_array< double>* dbl_ptr_array_ptr;
template< class T>
class ptr_array {
private:
T** member;
int count;
public:
int append( T* t_member);
int append( char* str);
};
==========================
========================
cfile.cpp
template< class T>
ptr_array< T> :: ptr_array( T* t_member)
{
append( t_member);
}
class ptr_array< int> :: ptr_array( char* str)
{
int t_member = atoi( str);
append( t_member);
}
class ptr_array< double> :: ptr_array( char* str)
{
double t_member = atof( str);
append( t_member);
}
==========================
=======================
I am trying to compile a program that compiled an ran under
Watcom 11c but gives me an overloaded operator error under
Visual Studio 6.0
Any help would be greatly appreciated
I gave an abbreviated version of the class.
Please let me know if anything else is needed to resolve.
--
Paul Baker
pabind@ameritech.net
------=_NextPart_000_001C_01C7070A.8C2BB310
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; =
charset=iso-8859-1">
<META content="MSHTML 6.00.5730.11" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial>headerfile.hpp</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>typedef unsigned short int =
doublebyte;</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>
<DIV><FONT face=Arial>typedef class ptr_array< =
char>*
char_ptr_array_ptr;</FONT></DIV>
<DIV><FONT face=Arial>typedef class
ptr_array< int>* =
int_ptr_array_ptr;</FONT></DIV>
<DIV><FONT face=Arial>typedef class ptr_array< =
double>*
dbl_ptr_array_ptr;</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>template< class =
T></FONT></DIV>
<DIV><FONT face=Arial>class ptr_array {</FONT></DIV>
<DIV><FONT face=Arial> private:</FONT></DIV>
<DIV><FONT face=Arial>
T** member;</FONT></DIV>
<DIV><FONT face=Arial>
int count;</FONT></DIV>
<DIV><FONT face=Arial> public:</FONT></DIV>
<DIV><FONT face=Arial> int =
append(
T* t_member);</FONT></DIV>
<DIV><FONT face=Arial> int =
append(
char* str); </FONT></DIV>
<DIV><FONT face=Arial>};</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT
face=Arial>=====================
==========================
====</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>cfile.cpp</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>
<DIV><FONT face=Arial>template< class T></FONT></DIV>
<DIV><FONT face=Arial>ptr_array< T> :: ptr_array( =
T*
t_member)</FONT></DIV>
<DIV><FONT face=Arial>{</FONT></DIV>
<DIV><FONT face=Arial> append( =
t_member);</FONT></DIV>
<DIV><FONT face=Arial>}</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>class ptr_array< int> ::
ptr_array( char* str)</FONT></DIV>
<DIV><FONT face=Arial>{</FONT></DIV>
<DIV> int t_member = atoi( str);</DIV>
<DIV><FONT face=Arial> append( =
t_member);</FONT></DIV>
<DIV><FONT face=Arial>}</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>class ptr_array< double> ::
ptr_array( char* str)</FONT></DIV>
<DIV><FONT face=Arial>{</FONT></DIV>
<DIV> double t_member = atof( str);</DIV>
<DIV><FONT face=Arial> append( =
t_member);</FONT></DIV>
<DIV><FONT face=Arial>}</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT
face=Arial>=====================
==========================
===</FONT></DIV>
<DIV> </DIV>
<DIV>I am trying to compile a program that compiled an ran under</DIV>
<DIV><FONT face=Arial>Watcom 11c but gives me an overloaded operator =
error
under</FONT></DIV>
<DIV><FONT face=Arial>Visual Studio 6.0</FONT></DIV>
<DIV><FONT face=Arial>Any help would be greatly appreciated =
</FONT></DIV>
<DIV>
<DIV>I gave an abbreviated version of the class.</DIV>
<DIV>Please let me know if anything else is needed to resolve.</DIV>
<DIV> </DIV></FONT><FONT face=Arial></FONT></DIV></DIV>
<DIV><FONT face=Arial>-- <BR>Paul Baker<BR><A
href="mailto:pabind@ameritech.net">pabind@ameritech.net</A></FONT></DIV=
</BODY></HTML>
------=_NextPart_000_001C_01C7070A.8C2BB310--