Загрузка данных


// ConsoleApplication3.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//

#include <iostream>
using namespace std;

class Cmplx {
public:
    double re;
    double im;
    Cmplx(double r, double i) {/* ??? */ }
};


class MyInt {
public: 
    int i;
    MyInt(int a) {  i = a;  }
    MyInt() {  i = 0;   }
    MyInt(MyInt& mi) {
        i = mi.i;    }
    MyInt& operator=(const MyInt& other) {
        i = other.i;    return*this;    }   
    MyInt operator-(const MyInt& other) {
        MyInt result;
        result.i = i - other.i;
        return result;    }
    MyInt operator*(const MyInt& other) {
        MyInt result;
        result.i = i * other.i;
        return result;    }
   /* MyInt operator+(const MyInt& other) {
        MyInt result;
        result.i = this->i + other.i;
        return result;
    }*/
};

MyInt operator+(const MyInt& me, const MyInt& other) {
    MyInt result;
    result.i = me.i + other.i;
    return result;
}
ostream& operator<< (ostream& strm, MyInt& mli) 
{    return strm << mli.i;  }
int main(){
    MyInt a;//?
    MyInt b(12);
    MyInt c(3);
    MyInt d = c;
    d = a + b; 
    d.operator=(operator+(a,b)); 
    //d = tmp1; 
    //d.operator=(tmp1);
    cout << d << endl;
    /*std::cout << b << endl;
    std::cout << c << endl;*/
}