previous | start | next

## Polymorphism

- You must alert the compiler that the function call needs to be preceded by the appropriate function selection, which can be a different one for every iteration in the loop.
- Such a selection/call combination is called dynamic binding.
- The traditional call, which always invokes the same function, is called static binding.
- To tell the C++ compiler that a particular function needs to be bound dynamically, the function must be tagged as `virtual`.

  >     class Clock
  >     {
  >     public:
  >        Clock(bool use_military);
  >        virtual string get_location() const;
  >        virtual int get_hours() const;
  >        int get_minutes() const;
  >        bool is_military() const;
  >     private:
  >        . . .
  >     };

previous | start | next