Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 November 9th, 2008, 04:06 PM
Registered User
 
Join Date: Mar 2008
Location: , , .
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


  #2 (permalink)  
Old November 9th, 2008, 09:39 PM
Registered User
 
Join Date: Mar 2008
Location: , , .
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!

 


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
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



All times are GMT -4. The time now is 05:20 PM.


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