Y
yilled_fred
Hi can anyone tell me why the following code cannot/doesn't compile?
I get the following error while compiling (g++ -c ):
"In member function `void derivedclass<S>::foo()':
test.h:20 error: parse error before `;' token
Here is the code, am I missing something?
#include <stdio.h>
#include <stdlib.h>
template <typename T>
class baseclass{
public:
baseclass(){}
template <typename R>
void bar(){
R i=5;
cout<<i<<endl;
}
};
template<typename S>
class derivedclass
ublic baseclass<S>{
public:
derivedclass(){}
void foo(){
bar<S>(); <---- error here
}
};
template class derivedclass<int>;
thanks!.
I get the following error while compiling (g++ -c ):
"In member function `void derivedclass<S>::foo()':
test.h:20 error: parse error before `;' token
Here is the code, am I missing something?
#include <stdio.h>
#include <stdlib.h>
template <typename T>
class baseclass{
public:
baseclass(){}
template <typename R>
void bar(){
R i=5;
cout<<i<<endl;
}
};
template<typename S>
class derivedclass
public:
derivedclass(){}
void foo(){
bar<S>(); <---- error here
}
};
template class derivedclass<int>;
thanks!.