Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MonsterDB {
- private :
- ~MonsterDB() {}; // prevents instances on stack
- public:
- static void DestroyInstance(MonsterDB *db) {
- delete db;
- }
- void doSomething() {}
- };
- int main() {
- MonsterDB *db = new MonsterDB();
- db->doSomething();
- MonsterDB::DestroyInstance(db);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement