Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
is there any issue in writing copy constructor without default constructor??
Posted 5-Feb-13 19:47pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
Comments
Matthew Faithfull at 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 at 6-Feb-13 13:35pm
   
+5 - me too.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

No issues at all.
—SA
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 480
1 Gihan Liyanage 225
2 OriginalGriff 174
3 Bhavik_Patel 170
4 PhilLenoir 155
0 Sergey Alexandrovich Kryukov 8,653
1 OriginalGriff 7,132
2 CPallini 2,598
3 Richard MacCutchan 2,060
4 Abhinav S 1,808


Advertise | Privacy | Mobile
Web04 | 2.8.140827.1 | Last Updated 6 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100