Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- template <class T>
- class cSum
- {
- T value;
- public:
- cSum(T first, T second)
- {
- value = first + second;
- }
- T Result() { return value; }
- };
- int main()
- {
- cSum<int> sum1(1, 4);
- cout << sum1.Result() << endl;
- cSum<float> sum2(1.2, 5.2);
- cout << sum2.Result() << endl;
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment