Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7173371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:48:37+00:00 2026-05-28T15:48:37+00:00

What does this statement mean? A default copy constructor or default copy assignment copies

  • 0

What does this statement mean?

A default copy constructor or default copy assignment copies all
elements of of the class. If this copy cannot be done, it is an error
to try to copy an object of class.

For example:

class unique_handle{    
    unique_handle(const unique_handle&);
    unique_handle&operator=(const unique_handle&);  
public ://...
};  

struct Y {
    unique_handle a;
}//require explicit initialization  
Y y1;
Y y2=y1; //error:cannot copy Y::a   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T15:48:39+00:00Added an answer on May 28, 2026 at 3:48 pm

    A default copy constructor or default copy assignment copies all elements of of the class.

    “Default” here is an unconventional way of saying “implicitly defined”.

    Since the class Y doesn’t declare a copy constructor (i.e. a constructor Y(Y&) or Y(Y const &)), then one is implicitly declared. When you try to use it, it is implicitly defined to copy all the base-class objects and members of Y (just a single member in this case), as if you’d written something like:

    Y::Y(Y const &other) : a(other.a) {}
    

    If this copy cannot be done, it is an error to try to copy an object of class.

    However, this constructor can only be defined if all the members can be copied. In this case unique_handle has a private copy constructor, which can’t be called from this constructor.

    Similarly, since Y doesn’t declare a copy-assignment operator (i.e. operator=(Y&) or operator=(Y const&)), then one is again implicitly declared. If you tried to use it, then it would be implicilty defined to assign all the members, as if you’d written:

    Y & Y::operator=(Y const & other) {
        a = other.a;
        return *this;
    }
    

    which again would fail, since unique_handle has a private copy-assignment operator.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All are from this post . What does these statement mean: error(nargchk(5, 6, nargin));
As I am a MySQL newbie. What does PARTITION mean in this MySQL statement?
What does this mean within my like statement? LIKE '%[ .,!?]' + keyword +
What does this statement mean? //allocated memory for Device info (*PppsCoreStructure)->psDeviceDetails=(sDeviceDetails **)calloc(CORE_DEVICEINFO_SIZE, sizeof(sDeviceDetails*)); I
What does this Statement Mean... A cycle was detected in the build path of
What does this statement mean? im3 = appendimages(im1,zeros(size(im1,1),gap)); appendimages is the function for concatenation
What does this statement mean??? [M N ~] = size(imge); I don't understand the
Does anyone have any idea what is wrong with this create statement for mysql?
What does this do exactly? <xsl:if test=./employee/first-name[@id='14'] > I mean, when will this case
What does this statement, Closing a ByteArrayOutputStream has no effect ( http://java.sun.com/javase/6/docs/api/java/io/ByteArrayOutputStream.html#close() ) mean?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.