Where is Serial.println() defined in the code?

This may be a dumb question, but where is Serial.println() defined in the code?

It looks to me like Serial is defined in HardwareSerial.h here:
extern HardwareSerial Serial;

But I do not see a println() method. I see begin(),end(),available(),peek(),read(),write(), etc. But no print() or println(). Is println() a macro defined somewhere or something?

Thanks,
J

The HardwareSerial class extends the Stream class, which in turn extends the Print class; that's where the print() and println() functions are defined.

kind regards,

Jos

HardwareSerial extends the Print class. That's where prinln() is defined :slight_smile:

Thanks guys! As you can see I'm new to OOP. I needed to study up on inheritance. Now it all makes total sense!

-J

Glad you asked that question. I've OO Programming for five years and didn't even know it!