#include <iostream.h>
template <class T>
class MyClass {
T value1, value2;
public:
MyClass (T first, T second)
{value1=first; value2=second;}
T module () {return 0;}
};
template <>
class MyClass <int> {
int value1, value2;
public:
MyClass (int first, int second){
value1 = first;
value2 = second;
}
int module (){
return value1value2;
}
};
int main () {
MyClass <int> myints (100,75);
MyClass <float> myfloats (100.0,75.0);
cout << myints.module() << '\n';
cout << myfloats.module() << '\n';
return 0;
}
|