You are viewing a single comment's thread from:

RE: what is singleton pattern in Object-oriented programming (OOP)

in #programming6 years ago (edited)

A creative usage of a post, indeed!

You can find the correct answer on wikipedia, or in a book about design pattern, if you can afford it (like the GOF)

A singleton is basically a globally unique instance of a class.

The class must be written so that it isn't possible to create new instances; instead, the only thing you can do is to take the only instance of that class. You must also disallow copying, or destroying, the instance.

The pattern part refers to how you actually implement such a thing in a language, a sort of recipe which you can use to achieve the goal.

Sort:  

thx what type of programmer you are ? game programmer ? or web programmer ? android programmer ? or something else ?

I mainly do back-end stuffs; no game, no web, no android: servers which provide services/API which aren't exposed in the wild.