I am working with some classes that were generated by someone else. Below is a section of the class, I have removed most of it because it is not relevant for this question
struct OrderStatus {
enum Value {
New = (char)48,
PartiallyFilled = (char)49,
Filled = (char)50,
Cancelled = (char)52,
Replaced = (char)53,
Rejected = (char)56,
Expired = (char)67,
Undefined = (char)85,
NULL_VALUE = (char)0
};
private:
Value m_val;
public:
explicit OrderStatus(int v) : m_val(Value(v)) {}
explicit OrderStatus(size_t v) : m_val(Value(v)) {}
OrderStatus() : m_val(NULL_VALUE) {}
constexpr OrderStatus(Value v) : m_val(v) {}
operator Value() const { return m_val; }
};
Two questions:
What does
operator Value()
do?I will be working with an instance of this class and want to do a
switch
on that instance'sm_val
but that is private. Is this possible?