Navigation



A.5 — Debugging your program (watching variables and the call stack)

In the previous lesson on stepping and breakpoints, you learned how to use the debugger to watch the path of execution through your program. However, stepping through a program is only half of what makes the debugger useful. The debugger also lets you examine the value of variables as you step through your code.

. . . → Read More: A.5 — Debugging your program (watching variables and the call stack)

A.4 — Debugging your program (stepping and breakpoints)

An introduction to debugging

Programming is difficult, and there are a lot of ways to make mistakes. As you learned in the section on handling errors, there are two primary types of errors: syntax errors and semantic errors.

A syntax error occurs when you write a statement that is not valid according to the . . . → Read More: A.4 — Debugging your program (stepping and breakpoints)

10.1 — Constructor initialization lists

Up until now, we’ve been initializing our class member data in the constructor using the assignment operator. For example:

class Something { private: int m_nValue; double m_dValue; int *m_pnValue; public: Something() { m_nValue = 0; m_dValue = 0.0; m_pnValue = 0; } };

When the class’s constructor is executed, m_nValue, m_dValue, and m_chValue are . . . → Read More: 10.1 — Constructor initialization lists

LearnCpp.com tutorials: Now with syntax highlighting!

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) . . . → Read More: LearnCpp.com tutorials: Now with syntax highlighting!

9.12 — Shallow vs. deep copying

In the previous lesson on The copy constructor and overloading the assignment operator, you learned about the differences and similarities of the copy constructor and the assignment operator. This lesson is a follow-up to that one.

Shallow copying

Because C++ does not know much about your class, the default copy constructor and default assignment . . . → Read More: 9.12 — Shallow vs. deep copying