munificent / game-programming-patterns

Source repo for the book
http://gameprogrammingpatterns.com/
Other
4.17k stars 496 forks source link

Subclass Sandbox Suggestion #380

Open matthewPapageorge opened 1 year ago

matthewPapageorge commented 1 year ago

In the Design Decisions subsection under "How does the base class get the state that it needs", it is suggested to use two stage initialization. It would be beneficial to point out that one need not create a factory method for each subclass. One could simply create a single template function returning a SuperPower*, enabling you to have a single function to create every SuperPower.