// ConsoleApplication3.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//
#include <iostream>
using namespace std;
class MyInt {
public:
int i;
MyInt(int a) {
i = a;
}
MyInt() {
i = 0;
}
//конструктор копирования
MyInt(const MyInt& mi) {
this->i = mi.i;
}
//равно
void operator=(const MyInt& other) {
i = other.i;
}
//плюс
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 = i * other.i;
return result;
}
};
ostream& operator<< (ostream& strm, MyInt& mli) {
strm << mli.i;
return strm;
}
int main(){
MyInt a(5);
MyInt b(12);
MyInt c(3);
MyInt d(a + b * c);
std::cout << d << endl;
/*std::cout << b << endl;
std::cout << c << endl;*/
}