Standard Template Library
The collection of genetic classes and functions is called Standard Template Library(STL).
Components of STL
Container is an object that actually stores data STL containers are implemented by template classes and therefore can be used
Standard Template Library
Sequence Containers The different Sequence Containers are: vector, list, map. Vector Sequence container stores the elements in contiguous memory locations and allows direct access to any element using subscript operator.
In this tutorial you will learn Iterators and specialized iterators in C++ Object Oriented Programming Language. Types of Iterators. Operations supported by Iterators.
Re-throwing Exception and Exception Specifications, Custom in C++ Object Oriented Programming Language
An exception handler may re-throw the exception caught, to do so, throw keyword is written without any argument, the control comes out from current try/catch block and enters into next try/catch block, listed in the program.
Exceptions: Need of Exceptions, keywords, Simple and Multiple Exceptions in C++ Object Oriented Programming Language
Exceptions are run-time anomalies or unusual conditions that a program may encounter.
Some anomalies are Divide By Zero, Accessing An Array Out of Its Bound etc. And Exception Handling is a method to handle those anomalies from occurring because these anomalies or unexpected errors can cause data loss. . . . .Try, Catch, Throw.
Templates – Function templates, Class templates in C++ object oriented programming language
C++ supports a mechanism known as template to implement the concept of generic programming.
Templates allows us to generate a family of classes or a family of functions to handle different data types.
Template classes and functions eliminate code duplication for different data types.
Class Template with multiple Parameters
Bubble Sort Using Template Function
Files: File Pointers, Error handling in File I/O, File I/O with member Functions in C++ Object Oriented Programming.
A File Pointer is used to access a byte in a file,
two types of pointer,
(a) get pointer(for reading)
(b) put pointer(for writing).
Input And Output Character By Character
Reading And Writing In A Binary File
Disk File I/O with Streams File Handling in C++ Object Oriented Programming Language
A program can receive/transfer data from/to
(a) Console I/O
(b) Disk File I/O
Data can be stored in a file using two formats
(a) Binary (b) Character
in binary format 512 takes 2bytes(16 bits), and in character format it occupies 3bytes, one for each digit.
In C++, the following hierarchy of classes is defined.
Working with multiple files in C++ Object Oriented Programming Language.
Stream in C++ Object Oriented Programming tutorial
A stream is a sequence of bytes, it acts as a source or destination for data.
The objects cin and cout are predefined in iostream file. The operator >> is overloaded in the istream class and << is overloaded in the ostream class. This is the reason, how, the same operator can handle various data types(e.g int, float, char. etc). Put() and get() functions Streams: Classes and Errors| OOP in C++ Programming Language.