 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Adnan Guest
|
Posted: Fri Jun 16, 2006 9:10 am Post subject: Non type template parameter Help |
|
|
Hi!
I am newbie in template stuff and I am getting error for the following
program
#include "stdafx.h"
using namespace std;
template <class T,char ch>
class paramClass
{
public:
void addNumbers(T num1,T num2);
};
template<class T,char ch)
void paramClass<T,ch>::addNumbers(T num1,T num2)
{
cout<< "The character is " <<ch<<endl;
cout<<"The Addition is "<< num1+num2;
}
void main(void)
{
paramClass<int,'G'>objMultiple;
cout<< " The resultant is " <<objMultiple.addNumbers(4,5);
}
I am getting following error
e:\RnD\C++\Templates\TmplFnNonType\TmplFnNonType.cpp(14): error C2143:
syntax error : missing ',' before ')'
on line "template<class T,char ch)"
what am I doing wrong? |
|
| Back to top |
|
 |
Ian Collins Guest
|
Posted: Fri Jun 16, 2006 9:10 am Post subject: Re: Non type template parameter Help |
|
|
Adnan wrote:
| Quote: |
I am getting following error
e:\RnD\C++\Templates\TmplFnNonType\TmplFnNonType.cpp(14): error C2143:
syntax error : missing ',' before ')'
on line "template<class T,char ch)"
what am I doing wrong?
Typing! |
try template<class T,char ch>
--
Ian Collins. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|