Calling an overridden method through a base class pointer/reference so C++ chooses the derived implementation at runtime.
- Base class method must be
virtual - Derived class overrides with
override - Usually use base pointer/reference in client code
PaymentMethodis base interfaceCreditCard,UPI,Cashare concrete implementationscheckout()acceptsconst PaymentMethod&and works with all methods
"Run-time polymorphism enables flexible behavior selection at execution time via virtual functions and dynamic dispatch."