ricardodovalle
26th February 2014, 16:25
Anyone knows a alternative to inheriting a enum and add more constants inside derived class?
Is it possible and it will work with switch and if?
Thanks
stampede
26th February 2014, 19:04
There is no way to directly inherit an enum in C++.
But you can create a simple workaround:
class MyEnumBase{
public:
enum{
Symbol1,
Symbol2
};
};
class MyEnumDerived : public MyEnumBase{
public:
enum{
Symbol3 = Symbol2+1,
Symbol4
};
};
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.