Object Comparison using if else | Operator Overloading <p>I have to <code>compare(&gt;,&lt;,==)</code> two <code>class object</code> based upon different criteria, explained below.</p> <pre><code>class Student { int iRollNumber; int iSection; int iMarks; } </code></pre> <ol> <li>I want to do comparison with <code>iRollNumber, iSection, iMarks</code> (Independently).</li> <li>I want to do comparison with <code>iRollNumber, iSection</code> (Combined).</li> <li>I want to do comparison with <code>iMarks, iSection</code> (Combined).</li> <li>..........</li> </ol> <p>Currently I am achieving this with <code>GetMethods()</code> and comparing them using <code>if elseif elseif..</code> structure.</p> <p>This is leading to the messy code everywhere!</p> <p>If I use <code>operator overloading</code> I have to decide on one way of comparison.</p> <p>Please suggest a way to do it with elegant coding. </p> <p>Or</p> <p>Can it be possible to call operator overloading Polymorphically?</p>