Say I have a character device like a graphics display. To use it, I include it's driver library and then make an instance of the "object" that is a "handle" for the device (sorry if the terminology is wrong).

The reason I need to figure out how to do this is that I'm wanting to write a sort of "fopen/fclose" type of library where I can open and close "file pointers" to different devices by using the AVR FDEV_SETUP_STREAM() functions. Ultimately, I want to do something like this (imagine I call my function "devopen"):

You could use a pointer or reference type for this:======== snip ========These are only really useful if your variable isn't global. If it is, you waste extra stack passing around something that the code can already see.

In the first code block, what does "Noritake_VFD_GUU100 *pointer" mean? Is it casting "pointer" as type "Noritake_VFD_GUU100"?

If so, that won't work because Noritake..... may not exist. This needs to be generic.

As far as functionality, I won't even be using Print. As I said in the OP, what I ultimately want to do is pass the pointer to FDEV_SETUP_STREAM() and create a standard "FILE *" data type to use with fprintf, fread, fwrite, etc...

The myInheritedClass inherits all the functions from myClass, so there is a .begin() function in there as well as the doSomething() function. Not only that, but it also inherits the type of it's base class - and ultimately the type of any base classes to that class. So an object of class myInheritedClass can also be referred to as an object of class myClass - but doing that it'll only know about the .begin() function. This facility is called "polymorphism" and is where much of the power of classes comes in to play.

So you can have lots of different classes for different (yet similar) things, like display modules, which all inherit, say, the Print class so you can use all the .print() / .println() functions with them. So you could have:

class barDisplay : public Print { public: int write(int c); // different function to write to the other type of display};

fooDisplay foo;barDisplay bar;

void printSomething(Print *ptr, char *text) { ptr->print(text);}

//...printSomething(&foo, "This is on foo");printSomething(&bar, "This would be on bar");

Two different classes, but both with the same pedigree. It's like having a collie and a red setter. They're markedly different dogs, but they are both dogs, and things that can be done to all dogs can be done to either kind of dog. But you can't round up sheep with a red setter.

As far as functionality, I won't even be using Print. As I said in the OP, what I ultimately want to do is pass the pointer to FDEV_SETUP_STREAM() and create a standard "FILE *" data type to use with fprintf, fread, fwrite, etc...

You might as well just use print, the writing functions fprintf and fwrite use will have to call print, so you can avoid the overhead by removing the entire file handling ( sd libs support print as well. ), majenko explains well what my DualWriter class is using.