Hi
I am a beginner in c++, please can someone tell me what's wrong with this code ? It gave me this error :'MyClass<T>' should be preceded by ':'
#include <iostream>
using namespace std;
template <class T> class MyClass {
T x,y;
public
MyClass(T a, T b)
{
x=a;
y=b;
}
T div() {return x/y;}
};
int main()
{
MyClass<double> d_ob(10.0,3.0);
cout << "double division: "<< d_ob.div() << "\n";
MyClass<int> i_ob(10,3);
cout << "integer division: "<< i_ob.div() << "\n";
return 0;
}
Thank you very much
your public
doesn't have a :
Last edited on
Thank you guys, I' m very sorry for this stupid question, but i have to learn