Answer Posted / achal ubbott
Question on copy constructor is a classic one for an
interview. Since most modern day c++ compilers provide a
default copy constructor, most people don't get to try
hands over it. But in some cases it becomes mandatory to
define your own copy constructor and override the default
one.
So the places when CC is invoked are:-
1. calling a function e.g. void f(sample A);
2. creating an object from the existing object.
e.g. sample A=B; // here B is existing object.
3. When a function returns a copy of object.
e.g. sample f()
{
sample a;
return a;
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
can inline function declare in private part of class?
what type of questions
How is polymorphism achieved?
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?
what is the sylabus for priliminaries?
What is abstraction in oops with example?
What is object and example?
Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)
What is property in oops?
Can a varargs method be overloaded?
What is encapsulation in simple terms?
What is object in oop?
What is a function in oop?
Why is polymorphism needed?
write a programe to calculate the simple intrest and compund intrest using by function overlading