#include <iostream>
#include "Sally.h"
using namespace std;
int main()
{
Sally a(34);
Sally b(21);
Sally c;
c = a+b;
cout << c.num << endl;
system("pause");
}
#include "Sally.h"
#include <iostream>
using namespace std;
Sally::Sally()
{
}
Sally::Sally(int a)
{
num = a;
}
Sally Sally::operator+(Sally aso)
{
Sally brandNew;
brandNew.num = num + aso.num;
return(brandNew);
}
#ifndef Sally_H
#define Sally_H
class Sally
{
public:
int num;
Sally();
Sally(int);
Sally operator+(Sally);
};
#endif // Sally_H
网友评论