Click here to Skip to main content
12,511,335 members (144,751 online)
Rate this:
 
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 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.
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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160929.1 | Last Updated 6 Feb 2013
Copyright © CodeProject, 1999-2016
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