是的,它终于来了。如果您的浏览器启用了 Javascript,教程中的代码示例现在将具有行号和语法高亮。例如,以前是
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; }
现在您将看到
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;
}
我仍在努力将以前的教程从旧样式转换为新样式,考虑到有 100 多个,我可能需要一段时间才能完成所有这些工作。
如果您尝试用鼠标选择语法高亮的代码并将其粘贴到另一个文档(或编译器)中,您也会得到行号。相反,请使用代码片段顶部的“复制到剪贴板”功能。这将把代码放入您的剪贴板,您可以像往常一样将其粘贴到另一个文档中。
如果这不起作用,请使用“查看纯文本”,它将显示没有语法高亮和行号的代码,并从那里以通常的方式复制。
我希望您会发现此更改为您的 C++ 体验带来了附加价值。
感谢您的光临。
-Alex