#include <iostream>
using namespace std;
class OneNumber
{
private:
int _num;
public:
OneNumber(int x);
int sumWithAnother(OneNumber n);
};
int main()
{
OneNumber aa(2);
OneNumber bb(8);
int sum = aa.sumWithAnother(bb);
cout << "sum: " << sum << endl;
}
OneNumber::OneNumber(int x) : _num(x) {}
int OneNumber::sumWithAnother(OneNumber n)
{
return (_num + n._num);
}
...
No comments:
Post a Comment