Where is the class "Print" defined?

I’m using the ADAFRUIT_SSD1306 library from GitHub.
One of the example programs contains the line
"display.println(“Hello, world!”);
The entity ‘display’ is an instantiation of Adafruit_SSD1306.
The class Adafruit_SSD1306 contains no function called ‘println’,
but the class Adafruit_SSD1306 inherits public member from the class Adafruit_GFX,
so ‘println’ must inherit its membership in class Adafruit_SSD1306 from class Adafruit_GFX.
Class Adafruit_GFX has no member called ‘println’, but it does inherit public members from a class called “Print”.
It seems clear that println must be a direct member of Print, but where is Print defined? I’ve looked high and
low and can find no object called “Print”. It seems obvious that it must be a system-defined class, but where is it
I’m stumped.

Hi @fguptill

The class Print is part of the Arduino-compatible Wiring language and is defined in a system file here:

Lots of classes inherit Print or the related class Printable since it knows how to, well, print various things. Print itself usually calls the lower level write method which often is overloaded in the original library (your display library).

1 Like

Thanks bko, that exactly answers my question. Is there a line in my code that calls up these utilities, or are they just there by default? Is it perhaps “#include application.h”?

They are part of the built-in system firmware that your code can use. They are just there for you.

In your library when you include application.h they become accessible.