mercredi 26 octobre 2016

Is it possible to declare an enum which is part of a class in a separate place?

I have a class with an attribute type of a custom enum class Class::Type. Currently the declaration of Class looks like this:

class Class {
    enum class Type {
        a,
        b,
        c,
        ...
    } type;
};

But I want to put the declaration of Class::Type somewhere else (preferably right after the class declaration) so that it doesn't obstruct the visual in the class declaration:

//something like this, if it was possible
class Class {
    enum class Type;
    Type type;
};

enum class Class::Type {
    a,
    b,
    c,
    ...
};

Is that possible? How?

Aucun commentaire:

Enregistrer un commentaire