C++ Interview Question and Answers
51. |
What do you mean by implicit conversion? |
|
- Whenever data types are mixed in an expression then c++ performs the conversion automatically.
- Here smaller type is converted to wider type.
- Example : in case of integer and float integer is converted into float type.
|
|
|
52. |
What are virtual functions? |
|
- The virtual fuctions must be members of some class.
- They cannot be static members.
- They are accessed by using object pointers.
- A virtual function can be a friend of another class.
|
|
|
53. |
What is the main purpose of overloading operators? |
|
- The main purpose of operator overloading is to minimize the chances of occurance of errors in a class that is using the overload operators.
- It also helps in redefining the functionalities of the operators to improve their performance.
-
Operator overloading also makes the program clearer, readable and more understandable by using common operators, such as +, =, and [].
|
|
|
54. |
What is a friend? |
|
Friends can be either functions or other classes. The class grants friends unlimited access privileges. |
|
|
55. |
What is stack unwinding? |
|
Stack unwinding is a process in which a destructor is invoked in a particular program for destroying all the local objects in the stack between throwing and catching of an exception. |
|
Lakshmi Narayanan, said |
May 13,2014 |
Stack Unwinding: Removing items from the stack in the last-In-First-Out manner. When we call a function, the called function is place onto the Call Stack of the application. When the control returns from a function then it's entry is removed from the call stack and the call is transferred to the calling function and then so on. This process is called as Stack Unwinding for functions. Similar mechanism happens in case of recursion also.
|
|