Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef COLORPOINT_CPP
- #define COLORPOINT_CPP
- #include <iostream>
- #include "point.cpp"
- using namespace std;
- class ColorPoint : public Point {
- private:
- Point a;
- string color;
- public:
- ColorPoint() : a(Point()), color("colorless") {}
- ColorPoint( Point a, string color) : Point a(a), color(color){}
- bool operator==(const ColorPoint& other) const {
- return a == other.a && color == other.color;
- }
- };
- #endif
- int main() {
- ColorPoint a(5,9, "red");
- ColorPoint b(5,9,"red");
- if (a == b){
- cout << "Points are equal" << endl;
- } else {
- cout << "Points are not equal" << endl;
- };
- return 0;
- }
Add Comment
Please, Sign In to add comment