Yup, it’s finally here. If you have a javascript enabled browser, code examples in the tutorials will now have line numbering and syntax highlighting. For example, instead of:
Cents& Cents::operator= (const Cents &cSource) { // check for self-assignment by comparing the address of the // implicit object and the parameter if (this == &cSource) return *this; // do the copy m_nCents = cSource.m_nCents; // return the existing object return *this; }
you will now see:
Cents& Cents::operator= (const Cents &cSource)
{
// check for self-assignment by comparing the address of the
// implicit object and the parameter
if (this == &cSource)
return *this;
// do the copy
m_nCents = cSource.m_nCents;
// return the existing object
return *this;
}
I am still working at converting the previous tutorials from the old-style to the new-style, and given that there are over 100 of them, it may take me a little while to get through all of them.
If you try to mouse-select the syntax-highlighted code and paste it into another document (or compiler), you will also get line numbers. Instead, use the “copy to clipboard” function at the top of the code snippet. This will place the code in your clipboard, and you can paste it into another document like normal.
If that doesn’t work for you, use “view plain”, which will show you the code without syntax highlighting and line numbers, and copy it from there in the normal manner.
I hope you find that this change brings some added value to your CPP experience.
Thanks for stopping by.
-Alex