Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


what is the difference between class to class type
conversion and copy constructor ?

Answers were Sorted based on User's Feedback



what is the difference between class to class type conversion and copy constructor ?..

Answer / sujatha

CLASS TYPE TO CLASS TYPE:

In class to class type this can be achieved through either
by using TYPE CONVERSIONS OR BY USING CONSTRUCTORS.
here one class object is convrted into another class object


COPY CONSTRuctor:

here we r copying already existing object value to new
object of the same type.

and copy constructor will get called when we are creating
new object of the class at the same time we r intializing
the object with the already existing object.
ex:

A a1; //a1 is object of class A
A a2=a1 //a2 object of class A. a2 is a new object and a1
//is already existing object.

Is This Answer Correct ?    8 Yes 0 No

what is the difference between class to class type conversion and copy constructor ?..

Answer / ganesh

this copy constructor is coping already existing object
values of same type

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More OOPS Interview Questions

what is overloading

3 Answers   MindCracker,


In multiple inheritance , to create sub class object , is there need to create objects for its superclasses??? in java and c++ both. Actually i have some information that is , all available members from its superclasses , memory created in subclass obj , so no need to create object for its superclasses...??? Thanks in Advance

1 Answers  


Which keyword is written to use a variable declared in one class in the other class?

5 Answers   TCS,


Why is polymorphism important in oop?

0 Answers  


what is virtual destructor

7 Answers   L&T, TCS,






What is memory leak and memory corruption?

1 Answers   TCS,


What normal C constructs work differently in C++?

2 Answers  


What is function overloading?,describe it with the example.

5 Answers  


What are oops functions?

0 Answers  


what type of question are asked in thoughtworks pair programming round ?

0 Answers   Thought Works,


What is abstraction in oops with example?

0 Answers  


What is overloading in oop?

0 Answers  


Categories