Click here to Skip to main content
15,885,948 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
is there any issue in writing copy constructor without default constructor??
Posted

As a consequence of declaring a copy constructor, the compiler won't automatically generate a default constructor (unless the compiler supports C++11 and the generation is forced by using the default keyword).

See http://en.cppreference.com/w/cpp/language/default_constructor[^] for more info.

Whether this will cause an issue depends on how the class is used.
 
Share this answer
 
Comments
Matthew Faithfull 6-Feb-13 6:35am    
Fascinating, I hadn't picked up that subtle change in C++11. You really do learn something new every day around here. +5
H.Brydon 6-Feb-13 13:35pm    
+5 - me too.
No issues at all.
—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900