What is Copy Constructor?

Answer Posted / shrikant kale

I think the answer to this is very interesting.

For one, I believe that in Java all objects are on the
heap, and while you don't have pointers, you do
have "References". References have copy symantics and java
internally keeps track of reference counts so that it's
garbage collector knows whats safe to get rid of.

Since you only access objects through copyable references,
the actual number of times you need to copy an object is
greatly reduced (for example, in C++ just passing an object
to a function (by value) results in new objects being copy
constructed, in Java only the reference to the object is
passed). The designers probably figured that clone() would
be enough for the remaining uses.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is atoi in c++?

570


Explain the use of vtable.

618


What are stl algorithms?

627


In what situations do you have to use initialization list rather than assignment in constructors?

635


What is increment operator in c++?

564






What does enum stand for?

617


What is nested class in c++?

522


What is the use of :: operator in c++?

601


Define namespace.

860


What is a string example?

551


write a c++ program to create class student having datamember name,Roll_no,age,and branch intilcization all the member using constructor print the all the details on the screen.

2253


How does c++ sort work?

568


How can I improve my c++ skills?

563


Can class objects be passed as function arguments?

609


What is the full form nasa?

595