samedi 30 avril 2016

Singelton Object for nullptr

I would like to be able to create a singleton object for a nullptr in C++, like scala has. More specific I would like to create a singelton of a class, which is a subclass of every other C++ class, so I can return this object instead of nullptr from methods of every return type. Is there a way I can achieve this in C++? I dont want to know if this is a bad design or something like this. I don't realy want to use this in a project, I am just wondering if you can make such a thing in C++.

Aucun commentaire:

Enregistrer un commentaire