title: Using C++ class inside C
body: <p>I am new to C++. What I am doing is creating a callback library file in C. That file will get use in C++ application. 
  C file will have only three functions and FYI I don't want to make another cpp file/class for that because of class overhead and also classes should be in cpp file only. please go through code snippet. C file XYZ.c is using class of ABC.hpp in its function.</p>
  
  <p>Allheader.hpp</p>
  
  <pre><code>#include&lt;iostream&gt;
   .
   .
  </code></pre>
  
  <p>ABC.hpp</p>
  
  <pre><code>#include "Allheader.hpp"
    .
    .
  </code></pre>
  
  <p>XYZ.h</p>
  
  <pre><code>func1();
  func2();
  func3();
  </code></pre>
  
  <p>XYZ.c</p>
  
  <pre><code>include "XYZ.h"
  include "ABC.hpp"
  
  func1()
  {
     using class of ABC here
  }
  
  func2() {}
  func3() {}
  </code></pre>
  
  <p>MyApplication.cpp</p>
  
  <pre><code>extern "C" { #include "XYZ.h"} 
     .
     .
  </code></pre>
  
  <p>So This file XYZ.c / XYZ.h will be use in My CPP application as callback.</p>
  
  <p>Compiling with g++</p>
  
  <p>What I have done. </p>
  
  <ol>
  <li>Compiled : It's Showing error, No file iostream.</li>
  <li><p>As I was compiling C file and using C++ inside it started using __BEGIN_DECLS</p>
  
  <p>and code in XYZ.c file was in</p>
  
  <p>__BEGIN_DECLS   __END_DECLS</p>
  
  <p>block suggested by a colleague. But still error 
  was the same.</p></li>
  </ol>
  
  <p>How can I use C++ inside C function? Please Suggest any solution.</p>