Look at this demo code:
enum class Solid {gold, silver, wood};
enum class Liquid {bier, wine, oil};
enum class Gas {air, elio, argon};
class P {
private :
struct Set {
Solid solid;
Liquid liquid;
Gas gas;
};
static const Set set[];
};
const P::set = {
{gold, wine, air}
};
GCG tell me:
error: ‘const P::Set P::set []’ is private within this context
const P::set = {
^~~
What's wrong? Yes, I would like initialize a static private class member not in the class definition.
Does anyone can explain me the how to do that? Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire