title: C++ Have class function pass reference to class itself?
body: <p>Basically, I have a <code>class World</code> that contains all the data relevant to the game state for my game. This class has functions like <code>getPlayerPosition()</code> and <code>hasLeader()</code>, and it also has access to the location of every drawable object in the game.</p>
  
  <p>Inside of <code>world.update()</code> I have an FSM of sorts running. I'll spare the details, but essentially I have another object that has a function called <code>test(World&amp; world, SceneNode&amp; node)</code> that takes a reference of the World so that it can test things like some node's distance from player. I have many of these "conditional" objects that do different things, so they each need access to different parts of World, which is why I pass in the World&amp;.</p>
  
  <p>But <code>world.update()</code> calls this test function! Can I get world to pass a reference of itself? In another build of this project I think we tried passing <code>(*this)</code>, but we were getting SegFaults and my partner believes it is because of <code>(*this)</code></p>