title: Compare a non-static data member with a constant member
body: <p>Following is the code, where I wanted to compare a non-static data member <code>check</code> with a constant data member <code>NULL_NODE</code> defined in the class.</p>
  
  <p>Why is it not able to compare? 
  what would be a recommended approach to have the <code>is_null</code> functionality as described in the code and keeping <code>NULL_NODE</code> a non-modifiable entity?</p>
  
  <pre><code>class test {
  public:
      struct st {
          int check;
          bool is_null() const { return NULL_NODE == check; }
      };
  
  private:
      const int NULL_NODE{-1};
  
  };
  
  
  int main() {
      return 0;
  }
  </code></pre>
  
  <p>Code was compiled with following command:
  <code>g++ -std=c++11 test.cpp</code></p>
  
  <p>Exception reported: </p>
  
  <pre><code>test.cpp: In member function ‘bool test::st::is_null() const’:
  test.cpp:8:39: error: invalid use of non-static data member ‘test::NULL_NODE’
           bool is_null() const { return NULL_NODE == check; }
                                         ^
  test.cpp:12:27: note: declared here
       const int NULL_NODE{-1};
  </code></pre>