C++ (Qt)class Foo{public: ...private: int f1; int f2; int f3;}; bool operator<(const Foo &foo1, const Foo &foo2){ if (foo1.f3 < foo2.f3) return true; if (foo1.f3 > foo2.f3) return false; if (foo1.f2 < foo2.f2) return true; if (foo1.f2 > foo2.f2) return false; if (foo1.f1 < foo2.f1) return true; return false;}