Initial Value of an Enum

前端 未结 10 582
陌清茗
陌清茗 2020-12-08 01:51

I have a class with a property which is an enum

The enum is

/// 
/// All available delivery actions
/// 
public enum E         


        
10条回答
  •  佛祖请我去吃肉
    2020-12-08 02:28

    My C++ teacher in college (11 years ago) told me that the linker replaces enum with their actual type:

    typedef static const int enum;

    Thus, any time you write something like enum MY_VAL = 5;, you could easily replace with static const int MY_VAL = 5; (but that just makes your code longer...).

    Anyway, the default value of any int is 0.

提交回复
热议问题