C++/CX: Is a singleton really single?


What is a singleton?  This is not to be confused with a simpleton, that would be the author of this blog.  A singleton is also referred to as a singleton pattern and limits the instantiation of a class to one time and only one time.   The Singleton Pattern is classified as a Creational Pattern as it is a factory method pattern.

The code that is used to start the DirectX Shooter game or really any Windows 8 or Windows 8.1 based game is an example of an app singleton:

int main(Platform::Array<Platform::String^>^)
    auto direct3DApplicationSource = ref new Direct3DApplicationSource();
    return 0;

For more information on the idea of an app singleton take a look at the Wikipedia article:


For C++ specific material view:


Comments (0)

Skip to main content