T
T
tugo2014-07-25 12:21:44
Programming
tugo, 2014-07-25 12:21:44

Enum forward declaration - what am I doing wrong?

I'm trying to make an Enum forward declaration.
I want the enum to belong to SomeClass.
SomeClass.h

class SomeClass
{
public:
    enum class InnerEnum : int
    {
        A,
        B,
        C
    };
}

OtherClass.h
enum class SomeClass::InnerEnum : int;

class OtherClass
{
private:
    SomeClass::InnerEnum mVariable;
};

The error is like this:
error: opaque-enum-specifier must use a simple identifier enum class SomeClass::InnerEnum : int;

UPD
Exhaustive answer stackoverflow.com/questions/13842006/c-forward-dec...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lolshto, 2014-07-25
@tugo

You can’t just declare it like that, just like you can’t declare a class in this way

enum class SomeClass::InnerEnum : int; //not valid
class Outer::Inner; //not valid
class some_namespace::Class; //not valid

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question