C++ Interview Question and Answers
106 |
What are the types of STL containers? |
|
- deque
- hash map
- hashmultimap
- hash_multiset
- hashset
- list
- map
- multimap
- multiset
- set
- vector
. |
|
|
107. |
What is the difference between method overloading and method overriding? |
|
Overloading a method (or function) in C++ is the ability for functions of the same name to be defined as long as these methods have different signatures (different set of parameters). Method overriding is the ability of the inherited class rewriting the virtual method of the base
class. |
|
|
108. |
What do you mean by inline function? |
|
An inline function is a function that is expanded inline when invoked.ie. the compiler replaces the function call with the corresponding function code. An inline function is a function that is expanded in line when it is invoked. That is the compiler replaces the function call with the corresponding function code (similar to macro). |
|
|
109. |
What is a template? |
|
A template can be used to create a family of classes or function.A template describes a set of related classes or set of related functions in which a list of parameters in the declaration describe how the members of the set vary. |
|
|
110. |
What is a copy constructor and when is it called? |
|
A copy constructor is a method that accepts an object of the same class and copies it members to the object on the left part of assignement. |
|
|