Wrox Programmer Forums
|
BOOK: Ivor Horton's Beginning Visual C++ 2005
This is the forum to discuss the Wrox book Ivor Horton's Beginning Visual C++ 2005 by Ivor Horton; ISBN: 9780764571978
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Ivor Horton's Beginning Visual C++ 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 9th, 2008, 04:06 PM
Registered User
 
Join Date: Mar 2008
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default CH 15: Highlighting Elements

All,

Greetings again. I took some time off of coding. What a mistake! On page 802 of the book, titled "Highlighting Elements," I made the following changes:

1. Amended the definintion of the base class CElement by adding a second parameter to the devlaration of the virtual void function Draw. The Draw function now looks like this:

virtual void Draw(CDC* pDC, CElement* pElement=0) {}

2. I amended the declaration of all the derived element classes, CLine, CCurve, CCircle, CRectangle by adding the new parameter and additional code to check and see if the selected element is the currene element.

3. I added a new COLORREF constant SELECT_COLOR to OurConstants.h and added an include statement for OurConstants.h in th CElements.cpp file as directed.

After compiling, I get 4 errors, one error for each class derived from CElements (that is the CLine, CCurve, CRectangle and CCircle).

1>c:\documents and settings\razzy\my documents\visual studio 2008\projects\sketcher\sketcher\element.cpp(45) : error C2572: 'CLine::Draw' : redefinition of default parameter : parameter 2

1>c:\documents and settings\razzy\my documents\visual studio 2008\projects\sketcher\sketcher\element.h(31) : see declaration of 'CLine::Draw'

1>c:\documents and settings\razzy\my documents\visual studio 2008\projects\sketcher\sketcher\element.cpp(98) : error C2572: 'CRectangle::Draw' : redefinition of default parameter : parameter 2

1>c:\documents and settings\razzy\my documents\visual studio 2008\projects\sketcher\sketcher\element.h(48) : see declaration of 'CRectangle::Draw'

1>c:\documents and settings\razzy\my documents\visual studio 2008\projects\sketcher\sketcher\element.cpp(149) : error C2572: 'CCircle::Draw' : redefinition of default parameter : parameter 2

1>c:\documents and settings\razzy\my documents\visual studio 2008\projects\sketcher\sketcher\element.h(62) : see declaration of 'CCircle::Draw'

1>c:\documents and settings\razzy\my documents\visual studio 2008\projects\sketcher\sketcher\element.cpp(199) : error C2572: 'CCurve::Draw' : redefinition of default parameter : parameter 2

1>c:\documents and settings\razzy\my documents\visual studio 2008\projects\sketcher\sketcher\element.h(76) : see declaration of 'CCurve::Draw'

Any help would be appreciated.

thanks,
Razzy


 
Old November 9th, 2008, 09:39 PM
Registered User
 
Join Date: Mar 2008
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I never should have taken several months off. I fixed it. I was setting the pElement pointer to zero in the CElements.cpp file as well as the the CElements.h file. How dumb of me!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 15 - Security aspcoder BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 7 May 3rd, 2008 02:55 PM
Masked Elements; Page 815; Ch 15 Nick Y BOOK: Ivor Horton's Beginning Visual C++ 2005 0 July 24th, 2006 02:12 PM
CH.15 NEED HELP stacy BOOK: Beginning ASP 3.0 1 January 21st, 2004 03:37 AM
Professional C# Second Edition Ch 15 Mike Smith BOOK: Professional C#, 2nd and 3rd Editions 0 January 5th, 2004 09:45 AM





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