title: C++ beginner's coding mistake: "Undeclared identifier"?
body: <p>I'm to use C++ for a very small part of my project. I must be coding something wrong, but my knowledge of C++ is what it is and I can't get around this...</p>
  
  <p>See both the AbstractContactListener.h and .mm files below. The problem is in isFixtureCollidingWithFixtureOfType(...) method, I can't access the _contact vector. What could I be doing wrong here?</p>
  
  <p>header:</p>
  
  <pre><code>struct JRContact {
      b2Fixture *fixtureA;
      b2Fixture *fixtureB;
      bool operator==(const JRContact&amp; other) const
      {
          return (fixtureA == other.fixtureA) &amp;&amp; (fixtureB == other.fixtureB);
      }
  };
  
  class AbstractContactListener : public b2ContactListener {
  
      id contactHandler;
  
  public:
      std::vector&lt;JRContact&gt;_contacts;
  
      AbstractContactListener(id handler);
      ~AbstractContactListener();
  
      void isFixtureCollidingWithFixtureOfType(b2Fixture fix, int type);
  
      virtual void BeginContact(b2Contact* contact);
      virtual void EndContact(b2Contact* contact);
  };
  </code></pre>
  
  <p>Implementation:</p>
  
  <pre><code>AbstractContactListener::AbstractContactListener(id handler) : _contacts() {
      contactHandler = handler;
  }
  
  AbstractContactListener::~AbstractContactListener() {
  }
  
  void isFixtureCollidingWithFixtureOfType(b2Fixture fix, int type){
  
      std::vector&lt;JRContact&gt;::iterator ct;
  
      // Next line is faulty... can't call _contacts.begin()
      // xCode says: "Use of undeclared identifier _contacts"
      ct = _contacts.begin();
  }
  
  
  void AbstractContactListener::BeginContact(b2Contact* contact) {
      // ...
  }
  
  void AbstractContactListener::EndContact(b2Contact* contact) {
      // ...
  }
  </code></pre>
  
  <p>Undeclared? Hmm. I thought I was declaring it in the header, right after the "public:" keyword.</p>
  
  <p>What could I be doing wrong here?
  thanks a lot!
  J.</p>