title: How can I convert C++ class which contain constructor to C struct?
body: <p>I want to draw rectangles in a window in <strong>C</strong>. I found the following <strong>C++</strong> <a href="http://www.mikylie.eu/draw.cpp" rel="nofollow noreferrer">code</a>
  I want to convert its classes to <strong>C</strong> struct to use it in my <strong>C</strong> project.
  I want to convert  the following <strong>C++</strong> class to <strong>C</strong> struct:</p>
  <pre><code>class Rect{
  public:
      int x1;
      int y1;
      int x2;
      int y2;
      Rect * next;
  
      Rect(){
          x1 = y1 = x2 = y2 = 0;
          next = NULL;
      }
  
      void draw(Display* d, Window w, GC gc){
          if((x1&lt;x2) &amp;&amp; (y1&lt;y2)){
              XDrawRectangle(d, w, gc, x1, y1, x2-x1, y2-y1);
          }
          if((x1&lt;x2) &amp;&amp; (y1&gt;y2)){
              XDrawRectangle(d, w, gc, x1, y2, x2-x1, y1-y2);
          }
          if((x1&gt;x2) &amp;&amp; (y1&gt;y2)){
              XDrawRectangle(d, w, gc, x2, y2, x1-x2, y1-y2);
          }
          if((x1&gt;x2) &amp;&amp; (y1&lt;y2)){
              XDrawRectangle(d, w, gc, x2, y1, x1-x2, y2-y1);
          }
      }
  };
  </code></pre>
  <p>I saw that it's possible to convert some <strong>C++</strong> classes to <strong>C</strong> structs <a href="https://stackoverflow.com/questions/41707545/converting-class-to-struct">here</a> and <a href="https://stackoverflow.com/questions/5872915/converting-a-c-class-to-a-c-struct-and-beyond">here</a> but the above class contains constructor.
  How can I convert a class which contains constructors into <strong>C</strong> struct and use it safely?</p>