fork download
  1. class A {
  2. private:
  3. int n;
  4. public:
  5. A(int n) : n(n) {
  6. }
  7. bool operator < (const A *obj) {
  8. if (obj->n < this->n)
  9. return true;
  10. else if (this->n < obj->n)
  11. return false;
  12. }
  13. operator const A* () const {
  14. return this;
  15. }
  16. };
  17.  
  18. int main()
  19. {
  20. A a(4), b(5);
  21. a < b;
  22. }
Success #stdin #stdout 0.02s 2720KB
stdin
Standard input is empty
stdout
Standard output is empty