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 class and object with example?

844


Can you explain polymorphism?

862


Can a varargs method be overloaded?

844


Why is polymorphism important in oop?

846


Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.

975


What is super in oop?

882


They started with the brief introduction followed by few basic C++ questions on polumorphism, inheritance and then virtual functions. What is polymorphims? How you will access polymorphic functions in C? How virtual function mechanism works?

1644


How can you overcome the diamond problem in inheritance?

984


What is abstraction in oop with example?

885


What does I oop mean?

858


how to get the oracle certification? send me the answer

1927


Give two or more real cenario of virtual function and vertual object

2103


Where You Can Use Interface in your Project

1643


What is a null tree?

891


Why is abstraction used?

868