Summer Internship MOOC’s
CSE-443
Object Oriented Programming using C++
eBOX
Submitted in partial fulfilment of the requirement for
Degree of
C++ [Self–paced]
Submitted to
LOVELY PROFESSIONAL UNIVERSITY
PHAGWARA, PUNJAB
From 1 June to 14 July
Submitted by
Name: ABHILASH PATYAL
Reg. ID: 11804187
To whom it may concern
I, Abhilash patyal, hereby declare that the work done by me
on
“Object Oriented Programming using C++” from 1 June to 14
July is an original work and is done by me only.
Name: Abhilash patyal
Acknowledgement
I pay my gratitude to Mr. Amandeep Nagpal, Additional Dean
& Associate, of Computer Science and Information
Technology, Lovely Professional University, Phagwara, Punjab
to giving me an opportunity to take part in summer
internship MOOC.
I express my gratitude to my friend Yaman singh, with whom
I completed this summer internship. He not only acted as a
study partner but also a supporter when doing the course.
Certificate
Introduction of Course
The course consists of concepts related to Object Oriented
Programming using C++. The course provides deep concepts
related to the concepts of C++. It helps in broadening our
programming knowledge by providing different types of
problems.
The course provides video tutorials, study materials to learn
the concepts and then problems and quizzes to test our
learning.
The best part of video tutorials is that it solves the given
problem in both Naïve and Efficient ways and explaining the
concepts behind the following approaches.
The course help in developing not only programming skills
but analytical skills also.
Content of the course
Introduction
Object Oriented Programming As the name suggests
uses objects in programming. Object-oriented programming
aims to implement real-world entities like inheritance, hiding,
polymorphism, etc in programming. The main aim of OOP is
to bind together the data and the functions that operate on
them so that no other part of the code can access this data
except that function.
Class The building block of C++ that leads to Object-Oriented
programming is a Class. It is a user-defined data type, which
holds its own data members and member functions, which
can be accessed and used by creating an instance of that
class.
Object An Object is an identifiable entity with some
characteristics and behaviour. An Object is an instance of a
Class. When a class is defined, no memory is allocated but
when object is created , memory is allocated.
Concepts of OOPS
Encapsulation is defined as wrapping up of data and
information under a single unit. In Object-Oriented
Programming, Encapsulation is defined as binding together
the data and the functions that manipulate them.
Abstraction is one of the most essential and important
features of object-oriented programming in C++. Abstraction
means displaying only essential information and hiding the
details. Data abstraction refers to providing only essential
information about the data to the outside world, hiding the
background details or implementation.
Polymorphism means having many forms. In simple
words, we can define polymorphism as the ability of a
message to be displayed in more than one form. Here we can
use function , constructors and destructors multiple times
with same name but different properties in any code.
Inheritance is the capability of a class to derive properties
and characteristics from another class. Inheritance is one of
the most important features of Object-Oriented
Programming. We can have base classes and derived classes.
Module – 1
Classes and Objects
Here we learned about classes and objects.
1. What is a class and an object
2. How to create class and it’s object
3. What are data members and member functions
4. How to access data members of a class using object
5. What is encapsulation
6. Using public, private and protected members
7. Relationship between classes
8. Constructor and Destructor
9. Types of constructor and destructor
10. Copy constructor
11. Friend Function
Module – 2
Relationships between Classes
Relationship between classes are as vital as the classes
themselves. In this module we learned about different types
of relationship between classes.
We learned what are relationships and how to establish
relationships between classes. The concepts of Association
Relationship , Aggregation Relationship and Composition
Relationship.
How does Cardinality play a role in relationship between
classes. Relationship cardinality represents the fact that each
parent entity or table within a relationship is connected to a
particular number of instances of the child entity or table.
Module – 3
Inheritnce
In inheritance we have base classes and derived classes.
And we have three different parameters for using members
functions and data members of one class into another.
1. Public - If we derive a sub class from a public base class.
Then the public member of the base class will become public
in the derived class and protected members of the base class
will become protected in derived class.
2. Private - If we derive a sub class from a Private base class.
Then both public member and protected members of the
base class will become Private in derived class.
3. Protected - If we derive a sub class from a Protected base
class. Then both public member and protected members of
the base class will become protected in derived class.
Inheritance can be done in different ways:
1. Single Inheritance - In single inheritance, a class is allowed
to inherit from only one class. i.e. one sub class is inherited
by one base class only.
2. Multiple Inheritance - Multiple Inheritance is a feature of
C++ where a class can inherit from more than one classes. i.e
one sub class is inherited from more than one base classes.
3. Multilevel Inheritance - In this type of inheritance, a
derived class is created from another derived class.
4. Hierarchical Inheritance - In this type of inheritance, more
than one sub class is inherited from a single base class. i.e.
more than one derived class is created from a single base
class.
5. Hybrid Inheritance - Hybrid Inheritance is implemented by
combining more than one type of inheritance.
Module – 4
Abstract Classes and Interface
Abstraction is the process of showing essential information
to the user and keeping the rest of the information and data
concealed.
Polymorphism means having many forms. In simple words,
we can define polymorphism as the ability of a message to be
displayed in more than one form. Here we can use function ,
constructors and destructors multiple times with same name
but different properties in any code.
Virtual function is a member function which is declared
within a base class and is re-defined(Overriden) by a derived
class. When you refer to a derived class object using a
pointer or a reference to the base class, you can call a virtual
function for that object and execute the derived class’s
version of the function.
Function overloading is a feature in C++ where two or more
functions can have the same name but different parameters.
Function overloading can be considered as an example of
polymorphism feature in C++.
Module – 5
Exception Handling
Exception Handling is a mechanism to handle runtime errors
such as ClassNotFoundException , IOException,
SQLException, RemoteException, etc. An error occurred.
Exception handling in C++ consist of three keywords - try ,
throw and catch.
Try statement allows you to define a block of code to be
tested for errors while it is being executed.
Throw keyword throws an exception when a problem is
detected, which lets us create a custom error.
Catch statement allows you to define a block of code to be
executed, if an error occurs in the try block.
Module – 6
File Handling
Files are used to store data in a storage device permanently.
File handling provides a mechanism to store the output of a
program in a file and to perform various operations on it.
In C++, files are mainly dealt by using three classes fstream,
ifstream, ofstream available in fstream headerfile.
ofstream - Stream class to write on files
ifstream - Stream class to read from files
fstream - Stream class to both read and write from/to files.
open() is used to open a file
close() is used to close a file
A file can be opened in read , write or both format.
Module – 6
String Handling
Strings are words that are made up of characters, hence they
are known as sequence of characters. In C++ we have two
ways to create and use strings:
1) By creating char arrays and treat them as string
2) By creating string object
Here we learned about initialisation , declaration and
implementation techniques for a string in different ways.
There are many in-built function in C++ for string.
Ex:
compare() , strlen() , strrev() , strcmp() , strcpy() , strcat() ,
etc,.
Reason of choosing the course
I choose the course because of its content.
I know how important the concepts of C++ are for a
programmer and how important it is to analyse a problem
and make classes and objects. This course provided me with
sufficient examples to understand different approaches one
can take to complete the same problem.
Learning outcome
1. Improved coding and analytical skills.
2. Deep concept clearance of each topic of C++.
3. Various new Techniques to solve a problem.
Thank You