So, firstly, what does “: public Print” do?
It says that the class being defined derives from another class (Print, in this case).
A derived class inherits all the properties (fields and methods) of the base class. This means that, for all intents and purposes the derived class is also the base class. Anywhere that an instance of the base class (Print) is needed, an instance of the derived class can be used.
And secondly, why can’t I do something similar to implement the print methods myself in my class
You can, if you do it right.
I’ve tried adding “: public Print” after the class name but get an error (listed below)
There are virtual classes, like Print, that declare methods (using the virtual keyword), but don't implement them. The derived class MUST provide an implementation of the virtual methods.
If you look at the Print.h file, you'll see that the write() method with one argument is declared.
If you look at the Print.cpp file, you'll see that it is called in many places, BUT, it is never implemented.
Any class that wants to derive from Print MUST implement the write() method with the signature defined in the base class.
As I said, this problem isn't a show-stopper, the two methods I've implemented manually work, but I'd like to know if I can do the same thing without having to code each different print method (for floats, longs, bytes etc) individually.
Sure. All you need to do is implement the write() method.
What you are doing by defining new methods in your class is hiding similar members defined in the base class.