Dynamic Casts or Function Overloads?
问题 Consider the following abstract class: class Abstract { public: // ... virtual bool operator==(const Abstract& rhs) const = 0; // ... }; Now suppose I'm creating multiple derived classes from this abstract class. However, each one uses a different algorithm when comparing with its own type, and a generic algorithm when comparing with any of the other derived classes. Between the following two options, which would be the better, more efficient option? Option A: class Derived : public Abstract