J
John Ratliff
What are the ramifications of creating a private copy constructor?
Say I didn't want any copies to be created, say if I had a singleton for
example.
Should I make the copy constructor public or private? I don't plan on
defining it. Does it make a difference?
If I make it private, what happens to the assignment operator? Does it
try to use the undefined private copy constructor, or would it use the
default copy constructor?
If the undefined copy constructor were public, what happens to the
assignment operator? Will it try to use the undefined public copy
constructor or will it use the default? I would think in this case it
would have to try and use the public undefined copy constructor, but
then fail since it's undefined.
Thanks,
--John Ratliff
Say I didn't want any copies to be created, say if I had a singleton for
example.
Should I make the copy constructor public or private? I don't plan on
defining it. Does it make a difference?
If I make it private, what happens to the assignment operator? Does it
try to use the undefined private copy constructor, or would it use the
default copy constructor?
If the undefined copy constructor were public, what happens to the
assignment operator? Will it try to use the undefined public copy
constructor or will it use the default? I would think in this case it
would have to try and use the public undefined copy constructor, but
then fail since it's undefined.
Thanks,
--John Ratliff