Is there any concise articles on what breaks encapsulation and how to properly make sure that encapsulation is maintained? |
I would recommend a book on OO design.
also I was also wondering if there was a program that outputs the step by step process that your program takes when it executes so it starts in main and then say main calls a function the program would output that info |
Any C++ debugger will let you run your program step-by-step interactively. For example these are the default key bindings in the Visual Studio debugger:
F5 - Continue running until next breakpoint.
Shift+F5 - Terminate debuggee.
F10 - Run until next line/statement, ignoring any function calls in the middle (in standard debugging parlance, "step over"). Note: functions will still be executed, but the debugger will not stop in them unless there's a breakpoint.
F11 - Same as step over, but go into functions ("step in")
Shift+F11 - Continue running until current function returns ("step out").
The debugger also lets you set breakpoints, which instruct it to pause execution when the control flow passes through specified points in the program. There's even data breakpoints, which pause execution when specified memory regions are modified. These are trickier to use, though, and you can only set a few because they're implemented in hardware.
Besides being used to track down bugs, debugging is actually a common technique to understand how a program written by someone else works. Even veterans can better understand a program by seeing it run that by just reading it.