I have a project in C++ and learning design pattern along the way (I'm very new to C++). I had a situation where I thought that a singleton would be a solution. (Now wait wait wait before you all go: singletons are baaaaaad. Let's all down vote and burn that heretic user!!!!)
I ran the example found here: https://stackoverflow.com/a/1008289/2336887
...but am getting an error when using the C++ 11 version.
My question is not whether Singleton should or not be used. It has been covered more than enough.
My question is: Why delete the public constructor and not simply the keep the private one? If it stays there, the error call to deleted constructor occurs. I don't understand and it frustrates me not to. Could somebody shed some light on a C++ newbie?
Here is the code to avoid going to the other post:
 class S {
 public:
     static S& getInstance(){
         static S    instance; 
         return instance;
     }
 private:
     S() {}
 public:
     S(S const&)               = delete;
     void operator=(S const&)  = delete;
 };
 int main() {
     S bus =  S::getInstance();
     return 0;
 }
Thanks for your help... and patience.
p.s.: I could have added the question to the original post, but at this point I think it would have brought more noise than anything.
 
     
    