How are the example Components instantiated in the Demo code?


#1

I was looking through the demo code in the JUCE repo and am confused how the classes in the Demos/ directory get instantiated. Are they instantiated because they are static and use the template? Does the compiler automatically instantiate them to derive the Template type?


#2

Well, they're static objects so they get created on startup, and their constructors register them in the list. See the JuceDemoType and JuceDemoTypeBase classes. The template is just there to make it possible to declare each type without writing an entire class for it.


#3

Great, thanks for the fast reply! Cool stuff...