Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include<deque>
  2. #include<iostream>
  3. #include<algorithm>
  4. #include<iterator>
  5. using namespace std;
  6.  
  7. class Liczba {
  8.     public:
  9.         Liczba(int n) : liczba(n) {
  10.             cout<<"normalny/konwertujacy\n";
  11.         }
  12.         operator int() const {
  13.             cout<<"operator int\n";
  14.             return liczba;
  15.         }
  16.         Liczba(const Liczba& l){
  17.             cout<<"kopiujacy";
  18.             liczba=l.liczba;           
  19.         }
  20.         Liczba operator + (Liczba& l){
  21.             cout<<"operator +";
  22.             liczba=liczba+l.liczba;
  23.             return *this;
  24.         }
  25.         Liczba operator = (Liczba& l){
  26.             cout<<"operator =";
  27.             liczba=l.liczba;
  28.             return *this;
  29.         }
  30.         int liczba;
  31. };
  32. int main() {
  33.     Liczba Lobj1(5);
  34.     Liczba Lobj2 = Lobj1 + 5;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement