You are currently viewing the BOOK: Ivor Horton's Beginning Visual C++ 2008 ISBN: 978-0-470-22590-5 section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
Exercises 7.5 & 7.6 use concepts that haven't been introduced
Exercise 7.5 & 7.6 are worded thus:
Quote:
5. Write a class called CTrace that you can use to show you at run time when code blocks have been entered and exited, by producing output like this:
Code:
function ‘f1’ entry
‘if’ block entry
‘if’ block exit
function ‘f1’ exit
6. Can you think of a way to automatically control the indentation in the last exercise, so that the output looks like this?
Code:
function ‘f1’ entry
‘if’ block entry
‘if’ block exit
function ‘f1’ exit
Having had plenty of experience with C++/C#, my first instinct would be to use destructors. However, destructors aren't covered in the book until Chapter 8. To satisfy my curiosity, I checked the solutions in the companion code for the book, and it indeed uses destructors.