I have two classes, let’s say DerivedOne and DerivedTwo, derived from a base class Base.
Assuming I have these:
DerivedOne d1;
DerivedTwo d2;
when I compare d1 and d2, I’d like d1 to always be smaller, in other words an object of DerivedOne should have a higher priority than an object of DerivedTwo. What is the best/nicest way to do that?
In the super class declare a variable as priority.
And in the subclasses constructor, initialize that.