0
About the singleton
Hello,
About the singleton, I'm actually try to use this pattern in order to use the same structure for 3 .cpp functions.
Maybe it's specific to C++ (I'm a Matlab user usually and discover the other language...), so I need to understand.
I'm not really sure about this example :
/** * Singletons should not be cloneable. */ Singleton(Singleton &other) = delete; /** * Singletons should not be assignable. */ void operator=(const Singleton &) = delete;
The "&other" is a variable or a C++ keyword ? I mean, Must I put the concerned variable to delete here, or "other" is enough to destroy all variable of a structure ? ^^"
At the last line here, why there are two "=" ? I don't understand this line...
Is there are an explanation and a definition of this ?
Thank you ^^
Сервис поддержки клиентов работает на платформе UserEcho
Hello,
for the "&other" is for the notion of "reference". A reference it's an alias, another name, for an already existing variable.
for the last line it’s an operator overload. here it's the operator equal (the first equal).
Best Regards