DIFFERENT CLASS
DEFINITIONS
List of Class Types
■ Concrete Class
■ Generic Class
■ Abstract Class
■ Interface Class
■ Container Class
Concrete Class
■ The basic definition of class applies here
■ All data members and member functions are defined.
■ Can be instantiated
■ Can be a child (derived) class and/or a parent (base) class
■ Can have virtual functions
Generic Class
■ allows type (Integer, String, … etc and user-defined types) to be a parameter when
the object is instantiated.
■ Generic Programming enables the programmer to write a general algorithm which
will work with all data types.
■ Generics can be implemented in C++ using Templates.
Abstract Class
■ A class is considered abstract if one or more of its virtual functions is pure
■ Abstract Classes cannot be instantiated
■ If you have decided that a class must be abstract, then you should make each
function that must be overridden pure virtual
■ Remember: a “non-pure” virtual function does not have to be overridden!
Interface Class
■ All functions in the class are pure virtual
– Does not have implementation of any of its methods
■ It can be considered as a collection of method declarations.
interfaceClass Programming Example
Container Class
■ A holder object that stores a collection of ■ Containers replicate structures very
other objects (its elements). commonly used in programming:
– Vectors
– Linked List
■ They are implemented as class templates,
which allows a great flexibility in the types – Queues
supported as elements. – Stacks
– Sets (Trees)
■ Many containers have several member – Maps
functions in common, and share
functionalities.