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
|