c++ Function to return an enum? -
so have namespace called paddlens class called paddle, inside paddlens have enum known colour
namespace paddlens { enum colour {white = 0, red = 1, purple = 2, blue = 3, green = 4, yellow = 5, orange = 6}; } class paddle : public entity { private: paddlens::colour colour; public: void nextcolour(); void previouscolour(); void paddlecolour(paddlens::colour col) { colour = col; } };
now then, wondering how go creating function return colour there easier way return in text form instead of value or better of using switch figure out colour is?
just return enum value:
class paddle : public entity { // before... paddlens::colour currentcolour() const { return colour; } };
Comments
Post a Comment