0% found this document useful (0 votes)
68 views9 pages

L22 ClassTypes PDF

The document defines and provides examples of different types of classes: - Concrete classes have defined data members and functions and can be instantiated. - Generic classes allow different data types as parameters when objects are instantiated, enabling general algorithms. - Abstract classes cannot be instantiated and have at least one pure virtual function that derived classes must implement. - Interface classes contain only pure virtual functions and define method signatures without implementation. - Container classes store collections of other objects and include common implementations like vectors, linked lists, queues and stacks.

Uploaded by

andrew
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views9 pages

L22 ClassTypes PDF

The document defines and provides examples of different types of classes: - Concrete classes have defined data members and functions and can be instantiated. - Generic classes allow different data types as parameters when objects are instantiated, enabling general algorithms. - Abstract classes cannot be instantiated and have at least one pure virtual function that derived classes must implement. - Interface classes contain only pure virtual functions and define method signatures without implementation. - Container classes store collections of other objects and include common implementations like vectors, linked lists, queues and stacks.

Uploaded by

andrew
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

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.

You might also like