Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > BOOK: Beginning Visual C++ 6
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Visual C++ 6
This is the forum to discuss the Wrox book Beginning Visual C++ 6 by Ivor Horton; ISBN: 9780764543883
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual C++ 6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 8th, 2005, 10:48 AM
Registered User
Join Date: Apr 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default EX9_03.CPP "bug" found/explained

EX9_03.CPP (Exercising the overloaded 'greater than' operator) works as it should.

However, on page 337, Ivor incorrectly states that this code will not work:

if(aBox > 20.0)

In fact, this code does work, and does not give any errors.

To refresh your memory, the reason the code was not supposed to work was because the overloaded operator ">" can only deal with comparing two CBox objects, not one CBox ojbect versus a float value.

This is why it works:

The constructor and destructor is called and a new CBox object is created! Its volume equals the 20.0 float value! It is this object that is compared to aBox! The dimensions of this box is lv = 20.0, bv = 1.0, and hv = 1.0. Once it is done, the CBox object is destroyed.

(There exists the possibility that it works because my verson of MSVC++ is 7, and not 6. Perhaps this did not work in version 6, but I believe it will.)

- www.jasondoucette.com (brother/partner)
- www.sawtoothdistortion.com (tech articles)

"Discussion is an exchange of knowledge; argument is an exchange of ignorance."

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ex6_02.cpp spareparts BOOK: Ivor Horton's Beginning Visual C++ 2005 1 February 19th, 2008 07:15 PM
Bug or no to bug learning C using VS.Net to compil tesh All Other Wrox Books 0 February 14th, 2007 01:06 PM
Ex9_03, page 483 & '571974 Code from the book' Nick Y BOOK: Ivor Horton's Beginning Visual C++ 2005 2 September 23rd, 2006 01:29 PM
Need This Explained arimakidd Beginning PHP 2 November 3rd, 2005 10:11 PM
visual cpp tanay Visual C++ 0 May 19th, 2005 08:00 AM

All times are GMT -4. The time now is 03:17 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.