© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu

C and C++ Interview Questions

15. What is a container class? What are the types of container classes?


Ans:

A container class is a class that is used to hold objects in memory or external storage. A container class acts as a generic holder. A container class has a predefined behavior and a well-known interface. A container class is a supporting class whose purpose is to hide the topology used for maintaining the list of objects in memory. When a container class contains a group of mixed objects, the container is called a heterogeneous container; when the container is holding a group of objects that are all the same, the container is called a homogeneous container.

Ex 1: What is a protocol class?

Ans:
An abstract class is a protocol class if:
Ø  it neither contains nor inherits from classes that contain member data, non-virtual functions, or private (or protected) members of any kind.
Ø  it has a non-inline virtual destructor defined with an empty implementation,
Ø  all member functions other than the destructor including inherited functions, are declared pure virtual functions and left undefined.

Ex 2: What is a mixin class?

Ans:
A class that provides some but not all of the implementation for a virtual base class is often called mixin. Derivation done just for the purpose of redefining the virtual functions in the base classes is often called mixin inheritance. Mixin classes typically don't share common bases.

Ex 3: What is a concrete class?

Ans:
A concrete class is used to define a useful object that can be instantiated as an automatic variable on the program stack. The implementation of a concrete class is defined. The concrete class is not intended to be a base class and no attempt to minimize dependency on other classes in the implementation or behavior of the class.

SLogix Student Projects
bottom