Passing I/O functions to a class.

Something like this.

MyClass * pClass = new MyClass(var1, var2);
pClass->Init();

var1 and var2 are some variables, just to show that you can pass them into the constructor or Init(). However, I must warn you about using uninitialized pointer variables. You must set a value to the pointer. The example above would crash on the Init-call if the pointer was pointing to either 0 or some random place in memory.

A safer way would be to use reference like MyClass & rClass; but this requires that you pass the reference via the constructor. It would be too late in the Init() function.

The third way is to just instantiate it with MyClass oClass; but this means you can't pass any variables in the constructor and you'll have to set the Init variables separately or with the Init() function.

As for function pointers, I would rather use derived classes. Function pointers are used more in C, but in C++ it's kinda not necessary most of the time. There are object oriented principles that involve implementing a factory for the creation of different kinds of objects, but it would take a lot of time to get a hold of and on simple projects it would just overcomplicate things for what it's worth..

The Serial class is probably instantiated already somewhere. I haven't checked how that works. It looks like the begin() function is enough to initialize it. I haven't seen the need to derive from it, but it also looks like the LCD libraries for example do. I'm sorry I'm still a bit new to Arduino, but I'm not that new to object oriented programming.