All challenges
Multiple ChoiceIntermediate 45s

Strategy vs Template Method

When should you favor Strategy over Template Method?
Options
  1. 1When you must fix the algorithm skeleton at compile time and vary steps by subclassing
  2. 2When you want subclass hooks with the skeleton defined by a base class and overridden
  3. 3When performance requires that virtual dispatch always be used for the algorithm
  4. 4When the varying behavior should be selected at runtime and composed rather than inherited

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle