Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <iostream>
- using namespace std;
- class Test
- {
- public:
- std::string Name;
- Test::Test(std::string name) : Name(name) {}
- std::string operator==(const Test& other) {
- if(this->Name == other.Name) return "Equal!";
- return "Not equal!";
- }
- };
- int _tmain(int argc, wchar_t* argv[])
- {
- Test a = Test("USA");
- Test b = Test("Canada");
- cout << (a == b) << "\n";
- b.Name = "USA";
- cout << (a == b) << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement