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
What is new keyword in oops?
What is class and example?
Why is abstraction used?
What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?
What are the components of marker interface?
How can you overcome the diamond problem in inheritance?
Please send ford technologies placement paper 2 my mail id
what are the ways in which a constructors can be called?
What is encapsulation process?
What are the two different types of polymorphism?
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
Following are the class specifications: class {int a}; class {int b}; Using friend funtion,calculate the max of two objects and display it.
What is polymorphism programming?
What is the real time example of inheritance?
2. Give the different notations for the class.\