title: Any way in C++ to forward declare a function prototype?
body: <p>I make regular use of forward class declarations and pointers to such classes.</p>
  
  <p>I now have a need to pass a function pointer through a number of layers. I would prefer to include the header that declares my function pointer's prototype only into the module that dereferences a function pointer rather than into each layer that simply passes along that pointer value.</p>
  
  <p>Is this possible?</p>
  
  <p>=====</p>
  
  <p>From the replies I suspect that I have not expressed by question clearly enough.  I seek an analog to a forward class declaration. We all agree that I can write:</p>
  
  <p>class foo;</p>
  
  <p>void bar(foo*);</p>
  
  <p>void waz(foo* p) { bar(p); }</p>
  
  <p>Notice that waz knows nothing about class foo other than its name. Perhaps bar will have access to foo's complete description. Perhaps bar will simply pass p further along. Who cares? Only those sites that dereference a foo*. All other sites need only "class foo;".</p>
  
  <p>Similarly I know that I can write:</p>
  
  <p>typedef void foo(int, double);</p>
  
  <p>void bar(foo*);</p>
  
  <p>void waz(foo* p) { bar(p); }</p>
  
  <p>The difference is that now the identifier foo not only is known to denote a function type but further already carries the full signature/prototype. This forces me into one of two unpleasant scenarios:</p>
  
  <p>1) clone the typedef at multiple sites (yuck! fragile!)
  2) stick the typedef in a header and include it everywhere that a foo* is mentioned.</p>
  
  <p>Notice the asymetry: in the case of a data object I only needed to provide a complete description of class foo at those points where I want to dereference a foo*; in the case of a function I need to provide the full signature/prototype everywhere I want to mention a foo*.</p>
  
  <p>So is there anyway to remedy this asymmetry?</p>