C++ Interview Question and Answers
101. |
What is an explicit constructor? |
|
A conversion constructor declared with the explicit keyword. The compiler does not use an explicit constructor to implement an implied conversion of types. It’s purpose is reserved explicitly for construction.Explicit constructors are simply constructors that cannot take part in an implicit conversion. |
|
|
102. |
What is the use of storage class specifiers? |
|
A storage class specifier is used to refine the declaration of a variable, a function, and parameters. The following are storage class specifiers :
- auto
- register
- static
- extern
|
|
|
103. |
what is assignment operator in c++? |
|
Default assignment operator handles assigning one object to another of the same class. Member to member copy (shallow copy). |
|
|
104. |
Can destructor be private? |
|
Yes destructors can be private. But according it is not advisable to have destructors to be private. |
|
|
105. |
What is strstream? |
|
stringstream provides an interface to manipulate strings as if they were input/output streams. ‹ strstream› to define several classes that support iostreams operations on sequences stored in an allocated array of char object. |
|
|