Created
February 5, 2018 16:33
-
-
Save betseg/60c982cf1277ca732fdcaa92787ee54d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
class Human { | |
public: | |
Human(std::string nin) { | |
name = nin; | |
} | |
Human() { | |
name = "foo"; | |
} | |
std::string name; | |
}; | |
class Group { | |
public: | |
Group(const Human& hin0, const Human& hin1) { | |
h0 = hin0; | |
h1 = hin1; | |
} | |
Human h0; | |
Human h1; | |
}; | |
Group operator+(const Human& lhs, const Human& rhs) { | |
return Group(lhs, rhs); | |
} | |
bool operator==(const Group& lhs, const Group& rhs) { | |
return lhs.h0.name == rhs.h0.name && lhs.h1.name == rhs.h1.name; | |
} | |
int main() { | |
Human me("me"); | |
Human you("you"); | |
Group we(me, you); | |
std::cout << ((we == me + you) ? "true" : "false"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment