Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<conio.h>
- using namespace std;
- class cos
- {
- int a, b;
- public:
- cos(int l1=0, int l2=0):a(l1),b(l2){}
- //cos(cos & kopia){a=kopia.a; b=kopia.b; }
- friend ostream & operator << (ostream &, cos &);
- cos & operator ++() {a++; b++; return *this; }
- friend cos operator +(const cos &, const cos &);
- };
- cos l1(3,4);
- cos l2(4,5);
- cos l3;
- int main()
- {
- //l2.wypisz();
- cout<<l2;
- ++l2;
- cout<<l2;
- l3=l1+l2;
- cout<<l3;
- getch();
- return 0;
- }
- cos operator +(const cos & l1, const cos & l2)
- {
- return cos(l1.a + l2.a, l1.b+l2.b);
- }
- ostream & operator <<(ostream & ekran, cos & l)
- {
- ekran<<l.a<<" "<<l.b<<endl;
- return ekran;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement