I’m confused as to how to add a TextEditorListener to my Class MainComponent : public Component. When I try to add the TextEditorListener, GCC complains that the following virtual functions are abstract and the compile fails:
Do you have a complete example that you could share. Like I said I’m really inexperienced at C++ and I don’t understand how to do what you’re telling me.
OK… that worked, but I’m confused. Why don’t I have to do the same thing with the ButtonListener Class? It has 2 virtual functions and i don’t have to define both of them in my program… only the one I want to use… ie. void buttonClicked (Button* button). Why don’t I have to define void buttonStateChanged (Button *button) also?
those are virtual, but they are not pure virtual. its the =0 bit at the end of a definition that makes it pure.
a pure vitral function has no implementation. it only defines an interface. the definition of an abstract class is a class that has at least one pure vitual function.
for example Thing might be an abstract class, and Toilet may be a concrete class (IE not abstract) derived (extends or inherets from) from Thing.
Toilet is a Thing. But not all Things are Toilets!
For example you could have a list of Things. some of them could be Toilets. but the list sees them all as Things.