Mail Archives: djgpp/1999/09/24/22:01:53
Ok... here ya go... (BTW, array is a data type w/ a template)
in my array.h file:
template<class Etype>
class Array
{
public:
Array(void);
private:
Etype y;
};
in array.C:
#include "array.h"
template<class Etype>
Array<Etype>::Array(void)
{
y = 0;
}
in main.C:
#include "array.h"
int main(void)
{
Array<int> x;
return 0;
}
The code may not be the best, but I'm still learning. Please help me, if you
can.
Eli Zaretskii wrote in message ...
>
>On Wed, 22 Sep 1999, Al Combs wrote:
>
>> I ws wondering if anyone knows the basic layout for templates using the
g++
>> compiler? I'm in a C++ class, and we use CC to compile. The templates we
>> have to design for CC are not compatable for g++. I need to know how to
>> switch back and forth. I understand CC uses the standard ANSI way. When
is
>> g++ gonna support the standard?
>
>AFAIK, g++ supports the standard. Please post sample code that is
>accepted by CC (on what platform, btw? CC doesn't tell anything about the
>machine and the OS) but rejected by g++.
>
>Also, what version of g++ are you using?
- Raw text -