Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- template<class type1, class type2> class Math{
- type1 x;
- type1 y;
- public:
- Math(type1 xVal, type1 yVal){
- this->x = xVal;
- this->y = yVal;
- }
- type1 sum(){
- return this->x+this->y;
- }
- };
- int main(){
- Math<float, int> m(1, 2.5);
- cout<<m.sum();
- }
Advertisement
Add Comment
Please, Sign In to add comment