CS201 Final Term Notes 2 by VU Learning
CS201 Final Term Notes 2 by VU Learning
Preparation
Prepared By VU Learning
Video Link: https://youtu.be/XzxLnuSRUMA
The & operator is used to get the address of a variable or an object. The & sign is
also used as a short hand for a reference.
Difference: Pointers may point to nothing while references always have to point to
something. The references used when we are implementing the call by reference &
we can implement the call by reference without using the * operator.
We do initialization as
int i = 0 ;
OR
int i ;
i=0;
The default assignment of C will carry out. ( If we have not defined the overloaded
operator for Assignment). The default assignment is a member-to-member
assignment.
• Initializes list is used to initialize the inner objects at the construction time.
Classes defined within other classes are called nested classes.
Lecture No.41:
A template is a sketch to draw some shape or figure. Template is allowing us the
reuse of a certain shape/code.
For normal code, you would use a class template when you want to create
a class that is parameterized by a type, and a function template when you want to
create a function that can operate on many different types.
Disadvantages:
If misused of templates then:
❖ Templates can make code difficult to read and follow depending upon
coding style.
❖ They can present seriously confusing syntactical problems esp. when the
code is large and spread over several header and source files.
❖ Then, there are times, when templates can "excellently" produce nearly
meaningless compiler errors thus requiring extra care to enforce syntactical
and other design constraints. A common mistake is the angle bracket
problem.
STL is a part of the official standard of C++. It is called STL i.e. Standard
Template Library. As a library, it is a tested code base. STL is a lot of important
code, pre-developed for us. It is available as a library.
The functions getRows() and getCols() are relatively simple. They do not change
anything in the object but only read from the object.
The variable is a name for a value. It is like a label on a box in the memory, which
contains a value. We can use this label to manipulate the value, instead of using the
address of the memory that contains the value.
A pointer is an address of a location in the memory.
3) The third construct is loop, which is a repetition structure that performs the
same task repeatedly with different values.
(Please also prepare Past Papers for subjective as well
as objective.)
Video Link:
https://youtu.be/XzxLnuSRUMA
Channel VU Learning:
https://www.youtube.com/c/VUlearning62