c++ struct OO vs class OO
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/92859/what-are-the-differences-between-struct-and-class-in-c">What are the differences between struct and class in C++</a><br>
  <a href="http://stackoverflow.com/questions/3432372/class-and-struct-in-c">class and struct in c++</a>  </p>
</blockquote>



<p>It looks like that struct can has constructor and destructor and members, and looks very simple, so can we use struct instead class, if not, when shall we use struct with functions when shall we use class ?</p>

<p><a href="https://github.com/developmentseed/node-sqlite3/blob/master/src/database.h#L32" rel="nofollow">https://github.com/developmentseed/node-sqlite3/blob/master/src/database.h#L32</a></p>

<pre><code>struct Baton {
    uv_work_t request;
    Database* db;
    Persistent&lt;Function&gt; callback;
    int status;
    std::string message;

    Baton(Database* db_, Handle&lt;Function&gt; cb_) :
            db(db_), status(SQLITE_OK) {
        db-&gt;Ref();
        uv_ref(uv_default_loop());
        request.data = this;
        callback = Persistent&lt;Function&gt;::New(cb_);
    }
    virtual ~Baton() {
        db-&gt;Unref();
        uv_unref(uv_default_loop());
        callback.Dispose();
    }
};

struct OpenBaton : Baton {
    std::string filename;
    int mode;
    OpenBaton(Database* db_, Handle&lt;Function&gt; cb_, const char* filename_, int mode_) :
        Baton(db_, cb_), filename(filename_), mode(mode_) {}
};
</code></pre>
