それは、その構造体のように見える可能性の重複:
What are the differences between struct and class in C++
class and struct in c++C++のstruct OOクラスOO対
できコンストラクタとデストラクタとメンバを持っており、非常にシンプルに見えますが、そうすることができます私たちはstructをclassの代わりに使用します。
https://github.com/developmentseed/node-sqlite3/blob/master/src/database.h#L32
struct Baton {
uv_work_t request;
Database* db;
Persistent<Function> callback;
int status;
std::string message;
Baton(Database* db_, Handle<Function> cb_) :
db(db_), status(SQLITE_OK) {
db->Ref();
uv_ref(uv_default_loop());
request.data = this;
callback = Persistent<Function>::New(cb_);
}
virtual ~Baton() {
db->Unref();
uv_unref(uv_default_loop());
callback.Dispose();
}
};
struct OpenBaton : Baton {
std::string filename;
int mode;
OpenBaton(Database* db_, Handle<Function> cb_, const char* filename_, int mode_) :
Baton(db_, cb_), filename(filename_), mode(mode_) {}
};
範囲は同じです。アクセスレベルは異なります。 –
それを指摘してくれてありがとう。私は訂正で私の答えを編集しました – BigDaveDev