Enums inside of a C++ class

I am trying to use a class that has an enum type declared inside the class like so:

class x {
public:
    x(int);
    x( const x &);
    virtual ~x();
    x & operator=(const x &);
    virtual double operator()() const;

    typedef enum  {
        LINEAR = 0,      /// Perform linear interpolation on the table
        DIPARABOLIC = 1  /// Perform parabolic interpolation on the table
    } XEnumType; 
};

I need to declare an instance of this class and initialize the enum type. I come from C# and normally see enums declared OUTSIDE of a class, not INSIDE like it is here. How do I initialize the enum type. For example, I want to do something like this:

x myX(10);   
myX.XEnumType = Linear;

Obviously this doesn't work. How would I do this?

5
задан Johannes Schaub - litb 6 May 2011 в 15:20
поделиться