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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an interface in oop?

784


How do you achieve polymorphism?

827


what are the ways in which a constructors can be called?

1806


Give an example where we have to specifically use C programming language and C++ programming language cannot be used?

1388


Why is there no multiple inheritance?

776


What is a superclass in oop?

916


What is encapsulation with example?

799


What are the three parts of a simple empty class?

1773


What is the real time example of encapsulation?

801


How does polymorphism work?

878


any one please tell me the purpose of operator overloading

2171


What is overloading in oops?

847


What is interface? When and where is it used?

1886


Can enum be null?

773


What do you mean by abstraction?

824