OOP Flashcards
Need of operator overloading
Intuitive syntax
Expressive
Improved Usability
Exception handling statements
try
catch
throw
rethrow (rethrow current exception)
noexcept (void function name() noexcept{})
Generic programming is done using -
Templates
Operator Overloading
Type traits
SFINAE
List and vector
Vector (dynamic array like, contiguous storage, efficient ins/del, efficient random access)
List (doubly linked container, non-contiguous, efficient ins/del, less efficient random access)
Types of iterators
Input
Output
Forward
Bidirectional
Random Access
Templates
Templates allow classes and functions to work with Diff data types… Allow generic programming
What is Stream
Sequence of bytes that are transferred between program and i/p o/p devices
Stream error
cerr - inst of ostream, (unbuffered)
clog - inst of ostream (buffered)
What are file pointers?
objects of file which help to manipulate
seekg() - Moves the get pointer (for reading) to a specified position.
seekp() - Moves the put pointer (for writing) to a specified position
Command Line arguments
Command line arguments are parameters or options passed to a program when it is executed from the command line or terminal.
What is STL
collection of stand template classes and functions which allow data structure implementation
It also provides iterators and functors
What are containers?
component of STL in which object/data is stored according to requirement.
stores operations too.
implemented at Template class
what are algorithms
generic function which is responsible for searching, sorting, comparing and editing
Manipulative (modifies element - reverse, copy, replace, swap)
Non manipulative (operates on elements - max, min, count, find)
Typename and export keyword
Typename - specify type, to avoid ambiguity in template metaprogramming
Export - to avoid multiple instantiations in the program, make available to various lib outside template lib
Formatted and unformatted i/p and o/p
interpret according to format provided - cin, cout
perform raw i/p and o/p functions without interpretting - get char() gets()
Advantages of container adapters
code readability
simplified interface
intuitive syntax
improved memory usage
enhanced performace