C++ Interview Question and Answers
46. |
What are the advantages of object oriented programming? |
|
- Class data type allows programs to organize as objects that contain both data and functions.
-
Data hiding or Abstraction of data provides security to data, as unrelated member functions cannot access its data.
-
Polymorphism promotes, reduces software complexity, as multiple definitions are permitted to an operator or function.
-
Inheritance allows a class to be derived from an existing class, thus promoting reusability of code.
|
|
|
47. |
What is integral promotion of data? |
|
- When C++ did not find the exact match of a function call, the compiler will promote data to find the nearest match.
-
For example, char type can be promoted to integer/float/double.
Integral promotions are purely compiler oriented.
|
`
|
|
48. |
What are the possible integral promotions while invoking overloaded functions? |
|
- Char data type can be converted to integer/float/double.
-
Int data type can be converted to char/double/float.
-
Float data type to integer/double/char.
-
Double data type to float or integer.
|
|
|
49. |
List out any four operators that can be overloaded? |
|
|
|
|
50. |
What does the following statement mean? |
|
- Void add :: show ()
-
The statement means that function show () is a member of the class add. And the function does not return any data type.
|
|
|
12345678910
Page 10 of 10