title: C++, class with method and enum type - can method and enum value have same names?
body: <p>I have the following class: </p>
  
  <pre><code>class washm_t 
  {
  public:
      enum door_t { closed = 0, open = 1 };
  private:
      door_t door_state ;
  public:
      int open() ;
  };
  </code></pre>
  
  <p>The problem with the class is that the <code>open</code> name is defined as both the name of the method inside of the class and the value of the enum type.</p>
  
  <p>The question is: can I somehow modify the code so that both <code>open</code> names work inside of the class or should I pick some other name for the <code>open()</code> method or for the <code>open</code> enum type value?</p>
  
  <p>This is how the <code>open()</code> function looks like:</p>
  
  <pre><code>int washm_t::open()
  {
      if(door_state == open)          // ~fails, 'open' interpreted as name of method
                                              //  not as name of enum type value
          return 1 ;
      else
          return door_state = open, 0 ;
  }
  </code></pre>