You are on page 1of 2

1.Process of Function call using Stack(LIFO) Data Structure.

2.inline qualifier substitues the function code in place of calls thus makings
functions execute faster but creates multiple copies of functions thus increasing
program memory.
3.Call by value and reference
4.Unary scope resolution operator(::) used to refer to global variable if v havname
for local adn global variables with same name)
5.Generic programming using function templates.
6.Pointer variable stores the address of variable.
7.Reference variable is just a another name to the variable.
eg.int x=3
int *xptr=&x // xptr contains the address of x
int &xref=x // xref is another name for x

*xptr=7
xref=7 //both change value of x to 7
8.Always inialize constant member of classes using Member Initializer syntax of
Constructors.Else error will be thrown.
9.Friend function are non member functions of class that can modify the non-public
data.
Used when overloading operators for operation on user defined objects.
10.Dynamic memory allocation using new operator(analogous to malloc in C)
11.Destructors for dynamically created objects are not called automatically(But
user has to use the keyword delete to call the destructor)
12.Declaring a class member as static creates only a single copy for all objects of
that class.
13.An operator can be overloaded in two ways:
a) As a member function of class:In this case the left operand should be an
object of that class
b)As a non-member global function taking the objects as input parameters.(As a
friend function)
14.Inheritance:
a).It is a form of software reuse in which you create a class that absorbs the
capabilities of a derived class.
b).Protected members-->can be accessed in derived class
.Private member cannot be directly accessed in derived class.But can be
accessed by base class member functions.
c)Constructor of Base Class is called first and Destructor of derived class is
called first.
d)Use private members only in inheritance rather than protected member(For
better security).
15.a)Polymorphism is ability of program to take multiple forms
b)A Pointer handle decides whether to call base class version or derived class
version.
Eg, Baseclass ptr--->BAse class Object calls base class version
Baseclass ptr--->Derived class objects calls base class version for that
derived class object.
Thus a Baseclass pointer cannot be used to call Derived Class specifc
functions normally.
Exceptions
i) Using virtual functions and overridinden functions in derived class.
ii) Using Downcasting i.e dynamic cast a base class pointer to derived class
pointer.
c)Abstract class is a class whiich will be inherited but its own Object has no
meaning.
can be declared abstract by declaring one of its function as pure virtual.
16.Using Stream input output
cin--->istream &(Object of class basic_istream)
cout--->ostream &(Object of class basic_ostream)
cerr and clog--->ostream &(Unbuffered and Buffered error stream)
<iostream> Header inherits from basic_istream and basic_ostream
<iomanip>Header used to manipulate streams eg setw and setprecision etc
functions

17. Stream is sequence of bytes.


File(fstream class) can be read/written basically in two ways.
a)Character format where interger 1234567 occupies 7 bytes.Formatted I/O
b)Binary mode where integer occupies 4 bytes irrespective of value.(Not in
representable format).Unformmated i/O i.e sequence of bytes--->With the Use of
class structure.

18.Exceptions:Used to create fault tolerant code(Errors occuring due to bad


input,no memory available etc)
Ideal process for defining new Exceptions is
i) Create new class MyException publicly derived from Exception
ii)Override the what method in the class with the "Error message"
iii)In try bloack throw MyException and catch it with base class reference ie
Exception &
iv)In catch block,call e.what() or do necessary handling.

19.Formatted file processing using >> and <<.


Unformatted file processing using read() and write().
20.STL---->Containers,Iterators,algorithms
Containers::a) Vector:Contiguous memory storage--> Dynamic array--
>push_back(),begin(),end(),size(),capacity(),resize(),rbegin(),rend()
b)list:Linear data structure-->push_front(),push_back(),
c)deque:Contiguous memory storage-->Benefits of both vector and
list-->
d)set-->sorted depending on functor--->rapid insertion and deletions
possible
e)map-->key value pairs-->sorted according to functor
Container adapters::a)Stack -->LIFO Data structure---
>pushElements(),popElements(),top();
b)Queue -->FIFO Data Structure-->push(),pop(),front()
c)Priority_queue-->Queue always sorted in descending order--
>pop removes the highest element-->push(),pop(),top();
Bitset:Collection of flags
Iterators:a)Input:eg istream_iterator used to transvers input stream
b)Output:eg ostream_iterator used to transverse output stream
c)Forward:Capablities of Input and Output
d)Bidirectional :Capablities of Forward iterator and Reverse
iterator(i.e operator-- defined)
e)Random access:Capablities of Bidirectional and some more(index
referring)
Algorithms:a)Use the weakest iterator possible for a particular algorithm
b)Function Object are Object of class which can be used in place of
function ptr/Predicate Function and has operator() defined.
Compiler makes these function calls inline making it efficient.

c)Lambda expression are unnamed function([]) which are not worth


naming(single use) and can deduce the return type.

You might also like