C++20 sections · 1024 units
Open in Course

Lessons from Team Uniforms

summary

You learned that virtual methods let derived classes provide their own implementations while callers use the base interface. This decouples the algorithm (counting matches) from the data representation (how teams store colors).

Polymorphism through pointers or references enables runtime dispatch.

The all-pairs comparison pattern appears often. You iterate ii from 0 to n-1, then jj from 0 to n-1, skipping i=ji = j.