من اين برنامه رو نوشتم ولي چون چندتا مشكل داره كامپايل نميشه كسي مي تونه كمكم كنه تا چند مشكل گرامي رو حل كنيم:11:
کد:#include <iostream>
#define EVER ;;
using namespace std;
class Add
{
public:
Add();
Add(int);
~Add() {}
Add(const Add&);
Add& operator+(const Add&);
void SetAdd(int);
int GetAdd() const;
private:
int itsX;
};
Add::Add():
itsX(0)
{}
Add::Add(const Add& rhs)
{
this->GetAdd() = rhs.GetAdd();
}
Add& Add::operator+(const Add& rhs)
{
this->GetAdd() += rhs.GetAdd();
return *this;
}
void Add::SetAdd(int x)
{
itsX = x;
}
int Add::GetAdd() const
{
return itsX;
}
int main()
{
Add one;
one.SetAdd(5);
Add two;
two.SetAdd(5);
cout <<one + two<<endl;
return 0;
}
