, , ++, - " " . ( , .) . .
, , Color - :
virtual void mixColors(Color &anotherColor) = 0;
, ( ) . .
:
// I am assuming RGB and CMYK are cheap to pass by value, which seems reasonable.
// If this is not true, you can always pass them by const reference.
RGB mix_colors(RGB rgb1, RGB rgb2) { ... }
CMYK mix_colors(CMYK cmyk1, CMYK cmyk2) { ... }
, , :
class RGB
{
public:
RGB & mix_colors(RGB);
};
class CMYK
{
public:
CMYK & mix_colors(CMYK);
};
-: , . , , , , ++ Haskell Common Lisp multi . , , .