Reputation: 101
I am trying to inherit typedef declarations for enum type from base class in derived class
class Base{
public:
enum Type{
UNSPECIFIED = 0,
TYPE1,
TYPE2
}
};
class Derived : public Base{
public:
enum Type{
UNSPECIFIED = 0,
TYPE1,
TYPE2,
TYPE3
}
};
How do we extend the enum
type declaration in the derived class?
Upvotes: 1
Views: 273
Reputation: 6039
You can't extend enums in C++ by inheritance. Not part of the language spec.
Some other ideas on how to do something like what you want here: Base enum class inheritance
Upvotes: 1