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
Why polymorphism is used in oops?
What are the 5 oop principles?
Which is better struts or spring?
i=20;k=0;
for(j=1;k-i;k+=j<10?4:3)
{
cout< what is the drawback of classical methods in oops? How to improve object oriented design skills? What is object and example? Give an example where we have to specifically use C programming language and C++ programming language cannot be used? What are constructors in oop? What are objects in oop? write string class as your own class in java without using
any built-in function What is polymorphism and types? What are two types of polymorphism? Why is static class not inherited? Can a varargs method be overloaded?