Hi,
Please consider the following classes:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class Shape
{
......
......
public:
virtual void draw(CDC & aDC, COLORREF color, COLORREF fcolor, int
width, BOOL Filled = false) = 0;
};
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class Line : public Shape
{
......
......
public:
void draw(CDC &dc, COLORREF color, COLORREF fcolor, int width,
BOOL Filled = false);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class ellipse : public Shape
{
......
......
public:
void draw(CDC & dc, COLORREF color, COLORREF fcolor, int width,
BOOL Filled = false);
};
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
My question is:
If I declared the member function "draw( )" inside the classes and
implemented the definitions of "draw( )" outside the classes, then
there will be an error messsage when compiling :
"redefiniti on of default parameter : parameter 5"
However, if I implemented all the definitions of "draw( )" inside the
classes, then the code can pass the compilation.
Would anybody please let me know what the issue is? Thakns a lot.
Please consider the following classes:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class Shape
{
......
......
public:
virtual void draw(CDC & aDC, COLORREF color, COLORREF fcolor, int
width, BOOL Filled = false) = 0;
};
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class Line : public Shape
{
......
......
public:
void draw(CDC &dc, COLORREF color, COLORREF fcolor, int width,
BOOL Filled = false);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class ellipse : public Shape
{
......
......
public:
void draw(CDC & dc, COLORREF color, COLORREF fcolor, int width,
BOOL Filled = false);
};
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
My question is:
If I declared the member function "draw( )" inside the classes and
implemented the definitions of "draw( )" outside the classes, then
there will be an error messsage when compiling :
"redefiniti on of default parameter : parameter 5"
However, if I implemented all the definitions of "draw( )" inside the
classes, then the code can pass the compilation.
Would anybody please let me know what the issue is? Thakns a lot.
Comment