C++ singleton implementation -


I was reading an example of singleton pattern in C ++.

  class singletons {Private: stable single singles alone; Singleton () {}; ~ Singleton () {}; Singleton (constant singleton and amp;); Single & amp; Operator = (Constant Singleton & amp;); Public: Stable Singleton and Economics (); Return once; }; }   

I do not understand what the following line does.

  Singleton (Constant Singleton & amp;);   

I have always used const for the method, but now the method is for the formal parameter, and '& amp; There is a special meaning or just a strange name and then the line: Stable Singleton and Millstein () {Return once; }; Why a & amp; In front of the law?

That row is given a name when you assign an object to an object The only type since it has been declared private in this case, this means that the copy maker will not be called outside the classroom. Okay, this is the issue for a singleton, right?

'& amp; On the other hand the context is called. Your copy maker refers to singleton as a parameter. To understand how the reference operator is used.

I recommend reading the C ++ book to understand references and classes in depth.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -