Top "Copy-constructor" questions

A copy constructor is a constructor that creates a new object that is a clone of an existing object.

QObject cloning

I know that Qobjects are supposed to be identities not values eg you cannot copy them and by default the …

c++ qt copy-constructor qobject
"deleting" copy ctor/assignment in C++11

In VS 2010 SP1, the following: class Foo { public: Foo() { } Foo(Foo const&) = delete; // Line 365 Foo& operator=(Foo const&…

c++11 copy-constructor assignment-operator
Why aren't copy constructors "chained" like default constructors and destructors?

Why aren't copy constructors chained (like default ctors or dtors) so that before the derived class's copy constructor is called, …

c++ constructor copy-constructor
Why doesn't C# support the concept of Copy Constructor?

I was asked this question in one of my interviews, but I wasn't able to find out exactly why this …

c# copy-constructor
Does Java have a default copy constructor (like in C++)?

Does Java has a default copy constructor as C++? If it has one - does it remain usable if I …

java c++ copy-constructor language-comparisons object-construction
Implementing the copy constructor in terms of operator=

If the operator= is properly defined, is it OK to use the following as copy constructor? MyClass::MyClass(MyClass const &…

c++ copy-constructor
Why does an in-place member initialization use a copy constructor in C++11?

I'm a little bit confused about the following code: struct A { std::atomic<int> a = 0; }; Which gives an …

c++ c++11 initialization atomic copy-constructor
compiler generated constructors

This is just a quick question to understand correctly what happens when you create a class with a constructor like …

c++ copy-constructor assignment-operator default-constructor
Call default copy constructor from within overloaded copy constructor

I need to write a copy constructor that deep copies the contents of a std::shared_ptr. However, there are …

c++ constructor shared-ptr copy-constructor deep-copy