A
Adnan
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?
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?