由买买提看人间百态

topics

全部话题 - 话题: shapecolor
(共0页)
G****A
发帖数: 4160
1
The question is inspired by Item 38 in <>. Given
following code,
*****************
enum ShapeColor { RED, GREEN, BLUE };
class Shape {
public:
virtual void draw(ShapeColor color = RED) const = 0;
...
};
class Rectangle: public Shape {
public:
//definition of draw() goes here.
...
};
********************
How to define the draw() in Rectangle so that it comes with a default
parameter value other than RED?
NOTE: the article did mention that a definition like this will not wor... 阅读全帖
(共0页)