A
Aman
Hi,
I'm using the g++ compiler to compile this on SunOS 5.8.
I get compilation errors when I use A* as return type but none when I
used void .
why is this ?
regards,
Aman.
----------errors -------------------
:6: syntax error before `*'
:20: syntax error before `*'
:20: `T' was not declared in this scope
:20: template argument 1 is invalid
:20: `T' was not declared in this scope
:20: parse error before `)'
:21: ANSI C++ forbids declaration `function' with no type
----------- Code --------------------
#include <iostream>
using namespace std ;
template <typename T>
class test {
public :
A* function(T) ; // using void as return type compiles fine .
private :
struct A{
T somedata ;
int i ;
} ;
};
template <typename T>
A* test<T> :: function(T in) // using void as return type works fine.
{
}
I'm using the g++ compiler to compile this on SunOS 5.8.
I get compilation errors when I use A* as return type but none when I
used void .
why is this ?
regards,
Aman.
----------errors -------------------
:6: syntax error before `*'
:20: syntax error before `*'
:20: `T' was not declared in this scope
:20: template argument 1 is invalid
:20: `T' was not declared in this scope
:20: parse error before `)'
:21: ANSI C++ forbids declaration `function' with no type
----------- Code --------------------
#include <iostream>
using namespace std ;
template <typename T>
class test {
public :
A* function(T) ; // using void as return type compiles fine .
private :
struct A{
T somedata ;
int i ;
} ;
};
template <typename T>
A* test<T> :: function(T in) // using void as return type works fine.
{
}