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

Why do we use oops?

581


What is overriding vs overloading?

571


Write A Program to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtual Functions)

3544


What is oops concept with example?

566


What is object-oriented programming? Webopedia definition

702






Why do we need oop?

649


What is oops with example?

551


Advantage and disadvantage of routing in telecom sector

774


Can abstract class have normal methods?

598


Which type does string inherit from?

606


Write a java applet that computes and displays the squares of values between 25 and 1 inclusive and displays them in a TextArea box

2019


How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction

1642


Which language is pure oop?

537


assume the program must insert 4 elements from the key board and then do the following programs.sequential search(search one of the elements),using insertion sort(sort the element) and using selection sort(sort the element).

1653


What is basic concept of oop?

684