B
Bolin
I am trying to compile the following dummy program using VC++6.0:
template < typename T >
class A
{
public:
A(T value) { m_value = value; }
T getValue() { return m_value; }
public:
typedef T Type;
private:
T m_value;
};
int main(int argc, char * argv[])
{
{
A<double> a(9)
A<double>::Type val = a.getValue();
}
return 0;
}
but when I do, I get the following:
C:\Program Files\Microsoft Visual
Studio\MyProjects\testInClassTypedef\main.cpp(43) : error C2143:
syntax error : missing ';' before 'tag::id'
C:\Program Files\Microsoft Visual
Studio\MyProjects\testInClassTypedef\main.cpp(43) : error C2146:
syntax error : missing ';' before identifier 'val'
C:\Program Files\Microsoft Visual
Studio\MyProjects\testInClassTypedef\main.cpp(43) : error C2275:
'A<double>::Type' : illegal use of this type as an expression
C:\Program Files\Microsoft Visual
Studio\MyProjects\testInClassTypedef\main.cpp(43) : error C2065: 'val'
: undeclared identifier
I was wondering if I was doing something wrong according to C++, or
according to VC++6.0.
Thanks
G.
template < typename T >
class A
{
public:
A(T value) { m_value = value; }
T getValue() { return m_value; }
public:
typedef T Type;
private:
T m_value;
};
int main(int argc, char * argv[])
{
{
A<double> a(9)
A<double>::Type val = a.getValue();
}
return 0;
}
but when I do, I get the following:
C:\Program Files\Microsoft Visual
Studio\MyProjects\testInClassTypedef\main.cpp(43) : error C2143:
syntax error : missing ';' before 'tag::id'
C:\Program Files\Microsoft Visual
Studio\MyProjects\testInClassTypedef\main.cpp(43) : error C2146:
syntax error : missing ';' before identifier 'val'
C:\Program Files\Microsoft Visual
Studio\MyProjects\testInClassTypedef\main.cpp(43) : error C2275:
'A<double>::Type' : illegal use of this type as an expression
C:\Program Files\Microsoft Visual
Studio\MyProjects\testInClassTypedef\main.cpp(43) : error C2065: 'val'
: undeclared identifier
I was wondering if I was doing something wrong according to C++, or
according to VC++6.0.
Thanks
G.