CSE202
OBJECT ORIENTED Programming
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Course Details
• L T P
3 0 2 [Five Hours/week]
• Text Book
“OBJECT ORIENTED
PROGRAMMING IN C++”
by
Robert Lafore
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Reference Books
• PROGRAMMING WITH C++
by
D RAVICHANDRAN
• OBJECT ORIENTED
PROGRAMMING IN C++
by
E BALAGURUSAMY
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Course Outcomes
CO1 :: identify basic programming constructs and use the
newly acquired skills to solve extensive programming
problems.
CO2 :: discuss the mechanism of code reusability by creating
own libraries of functions.
CO3 :: validate the logic building and code formulation by
designing code capable of passing various test cases.
CO4 :: interpret the principles of the object-oriented model
and apply it in the implementation in C++ language.
CO5 :: develop accurate, reliable and efficient software
applications.
CO6 :: apply the knowledge acquired to develop software
applications
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Course Assessment Model
• Marks break up
Attendance 5
Academic Task 50 (30+20)
ETE 45
• Total 100
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Academic Task
Component Week
1. Test 1 5th
2. Test 2 10th
3. Test 3 12th
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
CA
• Programming Practice using IamNeo Platform
50
• Best 2 out of 3 Academic Task
• Programming practice is a compulsory requirement
ETP
• Will be conducted on IamNeo Platform
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Academic Task
1. Each Academic task will contain 2 coding questions
and 10 MCQs
2. The weightage of programming practice which is
spread across 150 problems with 25 problems per
unit will be 20%.
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
CA Marking Scheme
• In order to qualify for programming practice marks, the student should
solve at 50% problems (eligibility condition).
• In case the student scores more than or equal to 81% in all the CA’s [Best
02 are to be taken from 03] then he/she will be eligible for obtaining 100%
of the marks awarded as 1mark allocated for every 5 problems correctly
solved after the mandatory first 50% problems capped with a maximum
score of 20.
• 71% - 80% in all the CA’s [Best 02 are to be taken from 03] 70% of the
marks awarded.
• 51% - 70% in all the CA’s [Best 02 are to be taken from 03 50% of the
marks awarded
• 30% - 50% in all the CA’s [Best 02 are to be taken from 03] 30% of the
marks awarded
• If a student has scored less than 30% in the CA’s [Best 02 are to be taken
from 03], then he/she will not be eligible for any benefit
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Why a Star Course?
• This course Serves as the basis for the product
based pathways
• This course is a star course as it has direct
bearing with the placements.
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
The hitch……
Some burning questions in mind......
• Is C the only language behind the development of
all these powerful softwares
• Why C++?
• How C++ is different from C language?
• Is there no scope of this language in industry?
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Flashback………..
What C language can do?????
• Device drivers are written in C language.
• All these modern programming languages are influenced by C language
• Compilers for Python and PHP language are also written in C language
• Embedded systems are also developed with the help of C language
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Is C only language?????
Lets answers your questions
No, C is not the only language for the development
of all these powerful system
If we talk about Windows operating system, only
Kernel is written in C language rest all other features
are provided with the help of C++ language
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
How does it differ from C
C uses top down approach for problem solving
There are no means of providing security.
C doesn't support inheritance, makes it more complex to
use because everything has to be written from scratch.
C is not able to represent real world modelling
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
No scope of language in Industry
Top rated Companies which has a dearth of C++ programmers
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Introduction to C++
In 1979, Bjarne Stroustrup, began work on "C with Classes”
The motivation for creating a new language originated from Stroustrup's
experience in programming for his Ph.D. thesis.
Stroustrup found that Simula had features
that were very helpful for large software
development, but the language was too
slow for practical use, while BCPL was fast but
too low-level to be suitable for large
software development.
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Q1
Major objective for C++ is to:
A. Represent real world entities in the form of
objects
B. Implement procedural approach
C. Implement top down approach
D. Implement functional programming
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Q2
Initial name of C++ was:
A. C++ with classes
B. C with classes
C. Objects with C++
D. C with objects
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Applications
•Git
•Microsoft Excel
•Oracle Database
•MySql
•Linux
•Unix
•Android
•Google
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
• WHY C++?????
Lets see
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Key features of C++
Object and Classes
Real world modelling
Encapsulation
Wrapping
Data Abstraction
Hiding of non required information
Inheritance
Reusability
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Key features of C++
Polymorphism
Many forms
Data Hiding
Security
Message Passing
Communication
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
(Objects)Daily Analysis
Look around you and identify some objects
Everything is an OBJECT
©LPU::
LPU ::CSE202:
CSE202 C++ Programming
OBJECT ORIENTED PROGRAMMING
Object ,Object and Object
A student, a professor
A desk, a chair, a classroom, a building
A university, a city, a country
A subject such as CS, Math, History, …
©LPU::
LPU ::CSE202:
CSE202 C++ Programming
OBJECT ORIENTED PROGRAMMING
Procedural Approach(C Language)
• Focus is on procedures
• All data is shared: no protection
• More difficult to modify
• Hard to manage complexity
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Data is not secure……..
FUNCTION 1
DATA 1
FUNCTION 2
DATA 2
FUNCTION 3
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Object Oriented Approach
• Emphasis is on data rather than procedure
• Programs are divided into what are known as
objects
• Data is hidden and cannot be accessed by
external functions
• New data and functions can be easily added
whenever necessary
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
DATA
MEMBER
FUNCTIONS
DATA
DATA
MEMBER
FUNCTIONS MEMBER
FUNCTIONS
OBJECT ORIENTED APPROACHABSTRACTION &
ENCAPSULATION
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Classes and Objects(Example 1)
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Classes and Objects(Example 2)
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Classes and Objects
• A class is a prototype or blueprint for
creating objects
• When we write a program in an object-
oriented languages like C++,Java, we
define classes, which in turn are used to
create objects
31
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Classes and Objects(Technical Example)
class
Time
inTime
hour Attributes:
hour = 8
minute minute = 30
Methods:
void addMinutes(int m)
void addMinutes( int m )
outTime
Attributes:
hour = 17
minute = 35
Methods: objects
void addMinutes(int m)
32
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
History of Object-Oriented Programming
• Started out for simulation of complex man-
machine systems, but was soon realized that it
was suitable for all complex programming
projects
• SIMULA I (1962-65) and Simula 67 (1967) were
the first two object-oriented languages
– Developed at the Norwegian Computing Center,
Oslo, Norway by Ole-Johan Dahl and Kristen
Nygaard
– Simula 67 introduced most of the key concepts of
object-oriented programming: objects and classes,
subclasses (“inheritance”), virtual procedures
33
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
The Ideas Spread
• Alan Kay, Adele Goldberg and colleagues at
Xerox PARC extend the ideas of Simula in
developing Smalltalk (1970’s)
• Bjarne Stroustrup develops C++ (1980’s) at AT
&T Bell Labs in Murray Hill, New Jersey, USA
– Brings object oriented concepts into the C
programming language
– Earlier name was C with Classes
– Later in 1983 the name changed to C++(The idea
of ++ is taken from the increment operator of C)
– In 1997, the ANSI/ISO made changes into the
language and it was standardised
34
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Features Continued…
Encapsulation
Abstraction
Reusability
Inheritance
Polymorphism
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Encapsulation
©LPU::
LPU ::CSE202:
CSE202 Object
OBJECT Oriented Programming
ORIENTED PROGRAMMING
Abstraction(Hiding Details)
© LPU :: CSE202 C++ Programming
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Reusability
Existing Features Existing Features + Additional Features
© LPU :: CSE202 C++ Programming
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Inheritance
But Mummy,
where did my
blue eyes
come from?
©LPU::
LPU ::CSE202:
CSE202 C++ Programming
OBJECT ORIENTED PROGRAMMING
Inheritance….
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Polymorphism
In front of father
In class
In CCD
One thing and many forms
©LPU::
LPU ::CSE202:
CSE202 C++ Programming
OBJECT ORIENTED PROGRAMMING
Polymorphism
• Ability to appear in many forms…
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING
Course Contents
•Classes and Objects •Operator Overloading
•Functions •Type Conversion
•Pointer •Inheritance
•Array •DMA
•String •Polymorphism
•Constructor and Destructor •Exception Handling
•File Handling •Templates and STL
LPU:: CSE202: OBJECT ORIENTED PROGRAMMING