#include <iostream>#include <string> class ID_Record{ public: unsigned int id; // Record ID used for database. std::string value;}; int main() { ID_Record a{6, "Tree"}; ID_Record b{3, "Platinum"}; if (a == b) std::cout << "Records are equal\n"; // This line should fail compilation.}
Standard input is empty
prog.cpp: In function ‘int main()’: prog.cpp:14:8: error: no match for ‘operator==’ (operand types are ‘ID_Record’ and ‘ID_Record’) if (a == b) std::cout << "Records are equal\n"; // This line should fail compilation. ~~^~~~
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!