Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "bits/stdc++.h"
- using namespace std;
- template < class T , class TT>
- class my{
- TT a; T b, c;
- public:
- my operator-(my );
- friend ostream& operator<<(ostream &out, my &x){
- out << x.a << ' ' << x.b << ' ' << x.c;
- return out;
- }
- friend istream& operator>>(istream &in, my &x){// &x is must find out the reason why
- in >> x.a >> x.b >> x.c;
- return in;
- }
- };
- template < class aa , class bb>
- my < aa, bb > my < aa, bb > :: operator-(my x){
- my temp;
- temp.a = a - x.a;
- temp.b = b - x.b;
- temp.c = c - x.c;
- return temp;
- }
- int main(int argc, char const *argv[]){
- my < int, float > ob,ob2, ob3;
- cin >> ob >> ob2;
- ob3 = ob - ob2;
- cout << ob3 << '\n';
- return 0;
- }
Add Comment
Please, Sign In to add comment