C++ changes to ENUM.


In the C++ world, the rules applying to enum have been altered.


    main ()
    {
        enum Currancy = {STERLING, DOLLAR, RUPEE};
                                                                
        enum Currancy GreenBack = DOLLAR;     // Valid in C and C++
        Currancy Pounds = STERLING;           // Valid in C++ only.

    }

    main ()
    {
        enum Currancy = {STERLING, DOLLAR, RUPEE};

        Currancy Pounds = STERLING;

        Pounds = 2;             // Invalid Statement.

        Pounds++;               // Invalid Statement.
    }


Examples:

o Example program.  

See Also:


C References

o C version of enum.


Top Master Index C++ Keywords Functions


Martin Leslie 25-Oct-98