Set - 1

Question 16 :

Explain the ISA and HASA class relationships. How would you implement each in a class design?

Answer :

A specialized class "is" a specialization of another class and, therefore, has the ISA relationship with the other class. An Employee ISA Person. This relationship is best implemented with inheritance. Employee is derived from Person. A class may have an instance of another class. For example, an employee "has" a salary, therefore the Employee class has the HASA relationship with the Salary class. This relationship is best implemented by embedding an object of the Salary class in the Employee class.


Question 17 :

When is a template a better solution than a base class?

Answer :

When you are designing a generic class to contain or otherwise manage objects of other types, when the format and behavior of those other types are unimportant to their containment or management, and particularly when those other types are unknown (thus, the generosity) to the designer of the container or manager class.


Question 18 :

What is a mutable member?

Answer :

One that can be modified by the class even when the object of the class or the member function doing the modification is const.


Question 19 :

What is an explicit constructor? 

Answer :

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.


Question 20 :

What is the Standard Template Library (STL)?

Answer :

A library of container templates approved by the ANSI committee for inclusion in the standard C++ specification. 
A programmer who then launches into a discussion of the generic programming model, iterators, allocators, algorithms, and such, has a higher than average understanding of the new technology that STL brings to C++ programming.