Toolbar::addDefaultItems() won't accept my factory

Based on the demo toolbar I tried the following:

Code in private section of GUI.h

juce::Toolbar topToolbar;

class CustomToolbarItemFactory : juce::ToolbarItemFactory {

	CustomToolbarItemFactory() {};

	void getAllToolbarItemIds(juce::Array<int>& ids) override {

	void getDefaultItemSet(juce::Array<int>& ids) override {

	juce::ToolbarItemComponent* createItem(int itemid) override {
		if (itemid == 1)
			return new juce::ToolbarButton(itemid, "", juce::Drawable::createFromImageData(BinaryDataStorage::fit_to_win_png, BinaryDataStorage::fit_to_win_pngSize), 0);
		return 0;


CustomToolbarItemFactory factory;

code in GUI constructor (GUI.cpp)


But this line: topToolbar.addDefaultItems(factory); gives me this error:

Error: Conversion is inaccessible base class “juce::ToolbarItemFactory” is not allowed. Any idea what’s wrong?

OOOh nevermind just realized I forgot public keyword lol

I changed to:

  class CustomToolbarItemFactory : public juce::ToolbarItemFactory {

but now I get another error:

Error: ‘GUI’: cannot instatiate abstract class

Okay that was another stupid mistake.