Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Xyz.h
- class Xyz
- {
- public:
- Xyz(int iVal);
- Xyz operator+(Xyz other);
- protected:
- int i_val;
- };
- # Xyz.cpp
- Xyz::Xyz(int iVal)
- {
- this->i_val = iVal;
- }
- Xyz Xyz::operator+(Xyz other)
- {
- return Xyz(this->i_val + other.i_val);
- }
- # Main.cpp
- Xyz *x;
- Xyz *y;
- Xyz *z;
- x = new Xyz(10);
- y = new Xyz(20);
- z = x + y;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement