SlideShare a Scribd company logo
1 of 68
College of applied Business(CAB) And Technology
Course Name
Object Oriented Programming (CSC-161)
Faculty Name
Mr. Tekendra Nath Yogi
Tekendranath@gmail.com
Course Title: Design and Analysis of Algorithms
• Course no: CSC- 161 Full Marks: 60+20+ 20
• Credit hours: 3 Pass Marks: 24+ 8 +8
• Nature of course: Theory + Lab
• Course Description:
– The course covers the basic concepts of object oriented programming using
C++ programming language.
• Course Objectives:
– The main objective of this course is to understand object oriented
programming and advanced C++ concepts such as composition of objects,
operator overloads, inheritance and polymorphism, file I/O, exception handling
and templates.
2Presented By: Tekendra Nath Yogi
Course Contents:
• Unit 1: Introduction to Object Oriented Programming (3 Hrs.)
– Overview of structured programming approach.
– Problems with structured programming.
– Object oriented programming approach
– Characteristics of object oriented languages
• Objects
• Classes
• Data abstraction and encapsulation
• Polymorphism
• Overloading
• inheritance
3Presented By: Tekendra Nath Yogi
Contd…
• Unit 2: Basics of C++ programming (5 Hrs.)
– C++ Program Structure
– Character Set and Tokens(Keywords, identifiers, constants,
operators, special symbols)
– Data Type ( Basic types, derived types, and user defined types)
– Type Conversion( Explicit conversion(Type cast operator), Implicit
conversion)
– Preprocessor Directives( include and define directives)
4Presented By: Tekendra Nath Yogi
Contd…
• Namespace
• Input/Output Streams (Cin and Cout) and Manipulators ( setw and endl)
• Dynamic Memory Allocation with new and delete
• Control Statements(abstract review of decision making and branching,
decision making and looping).
• Functions: Function Overloading (different number of arguments, different
types of argument)
• Inline Functions
• Default Argument
• Pass by Reference
• Return by Reference
5Presented By: Tekendra Nath Yogi
Contd…
• Scope (local, file, and class) and Storage Class.
• Pointers: Pointer variables declaration & initialization, Operators
in pointers(Address-of and value-at- the- address)
• Pointers and Arrays,
• Pointer and Function(Passing simple variables, passing arrays).
6Presented By: Tekendra Nath Yogi
Contd…
• Unit 3: Classes & Objects (8 Hrs.)
– A Simple Class and Object (class definition: data member and
function member)
– Accessing members of class
– Initialization of class objects: (Constructor, Destructor)
– Default Constructor, Parameterized Constructor, Copy Constructor,
The Default Copy Constructor,
– destructor
7Presented By: Tekendra Nath Yogi
Contd…
– Objects as Function Arguments,
– Returning Objects from Functions,
– Structures and Classes,
– Memory allocation for Objects,
– Static members,
– Member functions defined outside the class (Using scope resolution
operator).
8Presented By: Tekendra Nath Yogi
Contd…
• Unit 4: Operator Overloading (7 Hrs.)
– Fundamental of operator overloading, Restriction on
operator overloading, Operator functions as a class
members,
– Overloading unary and binary operator,
– Data Conversion (basic to basic, basic to user-defined,
user-defined to basic, user-defined to user-defined)
9Presented By: Tekendra Nath Yogi
Contd…
• Unit 5: Inheritance (7 Hrs.)
– Introduction to inheritance, Derived Class and Base Class,
– Access Specifiers (private, protected, and public),
– Types of inheritance(simple, multiple, hierarchical, multi-level,
hybrid)
– Public and Private Inheritance,
– Constructor and Destructor in derived classes,
– Aggregation (class with in class)
10Presented By: Tekendra Nath Yogi
Contd…
• Unit 6: Virtual Function, Polymorphism, and miscellaneous C++ Features (5 Hrs.)
– Concept of Virtual functions (difference between normal member function accessed with pointers
and virtual member function accessed with pointer)
– Late Binding, Abstract class and pure virtual functions
– Virtual Destructors, Virtual base class
– Friend function(friend class) and Static function,
– Assignment and copy initialization, Copy constructor,
– This pointer,
– Concrete classes(vs. abstract class),
– Polymorphism and its roles.
11Presented By: Tekendra Nath Yogi
Contd…
• Unit 7: Function Templates and Exception Handling (4 Hrs.)
– Function templates
– Function templates with multiple arguments
– Class templates
– templates and inheritance
– Exceptional Handling (Try, throw and catch)
– Use of exceptional handling.
12Presented By: Tekendra Nath Yogi
Contd…
• Unit 8: File handling (6 Hrs.)
– Stream Class Hierarchy for Console Input /Output,
– Unformatted Input /Output,
– Formatted Input /Output with ios Member functions,
– Formatting with Manipulators,
– Stream Operator Overloading,
– File Input/output with Streams,
13Presented By: Tekendra Nath Yogi
Contd…
– Opening and Closing files (open() and close() member function)
– Read/Write from File ( put() and get(), read(), and write(), member
functions)
– File Access Pointers and their Manipulators (seeks(), seekp(),
tellg(), tellP(), offset, and etc..)
– Sequential and Random Access to File,
– Testing Errors during File Operations (eof(), fail(),bad(), good())
14Presented By: Tekendra Nath Yogi
Laboratory Works
• Students should be able to implement the concepts of Object
Oriented Programming using C++ language.
15Presented By: Tekendra Nath Yogi
Text Books
• Robert Lafore, Object Oriented Programming in C++, Fourth Edition, SAMS
publications.
• Herbert Schildt, C++ The Complete Reference, Fourth Edition, Tata McGraw
Hill Publication.
16Presented By: Tekendra Nath Yogi
Reference Books
• Deitel and Deitel, C++ How to Program, Third Edition, Pearson Publication.
• Joyce Farrell, Object-oriented programming using C++, Fourth Edition,
Cengage Learning.
17Presented By: Tekendra Nath Yogi
Model Question F.M.: 60
P.M.: 24
Section A(Long Answer questions): Attempt any two questions [2*10= 20]
– 1.
– 2.
– 3.
• Section B(Short Answer questions): Attempt any eight questions [8*5=40]
– 4.
– 5.
– 6.
– 7.
– 8.
– 9.
– 10.
– 11.
– 12.
18Presented By: Tekendra Nath Yogi
Unit1: Introduction to objected oriented programming
• Programming:
– The art and science of creating programs
– Art: application of human creative skill and imagination.
– Science: systematic study through observation and experiment.
• So, to be a good programmer you should do a lot of experiment
and observation of programs by using your own creative skill
and imagination.
19Presented By: Tekendra Nath Yogi
Contd…
• Program:
– Program outlines exactly the steps needed to perform
a certain task.
– E.g., Add two numbers
20Presented By: Tekendra Nath Yogi
Contd…
• Programming language:
– A programming language is a tool used by
programmers for instructing a computer or computing
device to perform specific tasks.
21Presented By: Tekendra Nath Yogi
Contd…
• Classification Of Programming Languages:
– Machine Language:
• use 0 and 1 to express the instructions to perform a certain
task.
– Assembly Language:
• This language uses symbols to express the instructions to
perform the certain task.
– High-level language:
• This language uses mostly high level language like statement
to express the instructions to perform a certain task.
22Presented By: Tekendra Nath Yogi
Contd..
• The Top Programming Languages?
– IEEE Ranking of programming language:
23Presented By: Tekendra Nath Yogi
Programming Paradigms
• Program organizing principles are called programming
paradigms.
• Following are the five types of programming paradigm:
– Unstructured programming
– Procedural programming
– Structured programming
– Object-oriented programming
– Object-based programming
24Presented By: Tekendra Nath Yogi
Contd…
• Unstructured Programming paradigm:
– A Technique for organizing and coding computer
programs in which programmers put all their code in
one program.
25Presented By: Tekendra Nath Yogi
Contd…
• This programming technique provides tremendous
disadvantages (duplicacy and redundancy of code, code
maintenance problem, readability and many more ) once the
program gets sufficiently large
• For example, if the same statement sequence is needed at
different locations within the program, the sequence must be
copied.
• This has lead to the idea of extracting these sequences, naming
them and offering a technique to call and return from these
procedures. i.e., Reuse the same code at different places in the
program without copying it.
26Presented By: Tekendra Nath Yogi
Contd…
• Procedural Programming:
– Combine returning sequences of statements
into one single place
– A procedure call is used to invoke the
procedure
– After the sequence is processed, flow of
control proceeds right after the position
where the call was made
27Presented By: Tekendra Nath Yogi
Contd…
• With the introduction of parameters as well as procedures of procedures ( sub-
procedures) programs can now be written more structured and error free
– For example, if a procedure is correct, every time it is used it produces correct results
• The main program is responsible to pass data to the individual calls, the data is
processed by the procedures and, once the program has finished, the resulting
data is presented
28Presented By: Tekendra Nath Yogi
Contd…
• Now we have a single program which is divided into small pieces
called procedures
• To enable usage of general procedures or groups of procedures
also in other programs, they must be separately available
• For that reason, modular programming allows grouping of
procedures into modules
29Presented By: Tekendra Nath Yogi
Contd…
• Structured Programming (Modular Programming) Paradigm:
– During the 1970s it became clear that even well-structured programs were
not enough for mastering the complexity involved in developing a large
program system
– It was also recognized that it was necessary to support the division of the
program into well-defined parts or modules, that could be developed and
tested independently of one another, so that several people could work
together within one large programming project
– Modular programming (subset of procedural programming)is thus
concerned with the subdivision of programs into manageable "chunks"
30Presented By: Tekendra Nath Yogi
Contd…
• With modular programming procedures of a common
functionality are grouped together into separate modules
• A program therefore no longer consists of only one single
part.
• It is now divided into several smaller parts which interact
through procedure calls and which form the whole
program
31Presented By: Tekendra Nath Yogi
Contd…
• Each module can have its own data. This allows each module to manage an
internal state which is modified by calls to procedures of this module
32Presented By: Tekendra Nath Yogi
Contd…
33Presented By: Tekendra Nath Yogi
CPS235: Introduction 33
Unstructured, procedural, modular programming
Unstructured programming.
The main program directly
operates on global data
Procedural programming.
The main program
coordinates calls to
procedures and hands over
appropriate data as parameters
Modular programming. The main
program coordinates calls to
procedures in separate modules
and hands over appropriate data
as parameters
Contd…
• Features of structured programming:
– Emphasis is given on algorithm rather than on data.
– Large programs are divided into smaller programs known
as functions and functions are grouped into modules.
– Most of the functions share global data.
– Data move openly around the system from function to
function.
34Presented By: Tekendra Nath Yogi
Contd…
• Advantages of structured programming: The
following are the major advantages of structured
programming.
– Reduced complexity
– Increased productivity
– portability
35Presented By: Tekendra Nath Yogi
Contd…
• Problems with structured programming: Some
problems with structured programming are:
– Complexity of managing large projects
– Data under-valued
– Relationship to real world
– New data types
36Presented By: Tekendra Nath Yogi
Contd…
• Complexity of managing large projects:
– As programs grow larger, even structured programming
approach begins to show signs of strain.
– No matter how well the structured programming approach is
implemented, the project becomes too complex, the schedule
slips, more programmers are needed, and costs skyrocket.
37Presented By: Tekendra Nath Yogi
Contd…
• Data Undervalued:
– Data is given second-class status in the organization of
procedural languages.
– A global data can be corrupted by functions. Since many
functions access the same global data, the way the data is
stored becomes critical.
38Presented By: Tekendra Nath Yogi
Contd…
• Relationship to the Real World:
– Procedural programs are often difficult to design
because their chief components – functions and data
structures – don’t model the real world very well.
39Presented By: Tekendra Nath Yogi
Contd…
• New Data Types:
– It is difficult to create new data types with procedural languages.
– Furthermore, most Procedural languages are not usually extensible
and hence procedural programs are more complex to write and
maintain.
40Presented By: Tekendra Nath Yogi
The problems faced in the structured programming approach are the
motivating factor in the invention of objected oriented approach.
Contd…
• Object Oriented Programming(OOP) Paradigm:
• In the OOP approach, data and the functions, which are supposed to have the
access to the data, are packed together into a single unit known as an object
• An objected-oriented program may thus consists of number of objects .
• Each Objects of the program is capable of receiving message, processing data ,
and sending messages to other objects thus, can be viewed as an independent
machine with a distinct role and responsibility.
41Presented By: Tekendra Nath Yogi
Characteristics(features) of object oriented languages:
• Different features of object oriented programming are:
– Objects
– Classes
– abstraction
– Encapsulation
– Inheritance
– Polymorphism
– Message passing
42Presented By: Tekendra Nath Yogi
Contd…
• Objects:
– Objects are the basic run- time entities in an object-oriented program.
– They may represent a person, place, table etc. They are identified by its
unique name.
– An object represents a particular instance of a class. There can be more
than one instance.
– Each object contains data and code to manipulate the data. So, they occupy
space in memory.
43Presented By: Tekendra Nath Yogi
Contd…
• Classes:
– Collection of objects is called class. It is a logical
entity. So, it does not occupy space.
– Classes are user defined data types and objects are
variables of class.
– Once a class has been defined we can create any
number of objects for that class
46Presented By: Tekendra Nath Yogi
Contd…
• Abstraction:
– Abstraction means the representation of the essential
features without providing the internal details and
complexities.
• For example: phone call, we don't know the internal
processing.
– In OOP, abstraction is achieved by the help of class,
where data and methods are combined to extract the
essential features only.
48Presented By: Tekendra Nath Yogi
Contd…
49Presented By: Tekendra Nath Yogi
Contd…
• Encapsulation:
– Encapsulation is the process of combining the data (called
fields or attributes) and functions (called methods or
behaviors) into a single framework called class.
– Encapsulation helps preventing the modification of data
from outside the class by properly assigning the access
privilege to the data inside the class.
– So the term data hiding is possible due to the concept of
encapsulation, since the data are hidden from the outside
world.
50Presented By: Tekendra Nath Yogi
Contd…
• Inheritance:
– Inheritance is the process of acquiring certain
attributes and behaviors from parents.
• For examples, cars, trucks, buses, and motorcycles inherit
all characteristics of vehicles.
52Presented By: Tekendra Nath Yogi
Contd…
– Object-oriented programming allows classes to inherit
commonly used data and functions from other classes.
– If we derive a class(called derived class) from another class
(called base class), some of the data and functions can be
inherited so that we can reuse the already written and tested
code in our program, simplifying our program.
55Presented By: Tekendra Nath Yogi
Contd…
• Polymorphism:
– The word polymorphism means having many forms.
– Real life example of polymorphism, a person at a same
time can have different characteristic. Like a man at a
same time is a father, a husband, a employee. So a same
person posses have different behavior in different
situations. This is called polymorphism.
56Presented By: Tekendra Nath Yogi
Contd…
• Polymorphism is considered as one of the important features of
Object Oriented Programming.
• In C++ polymorphism is mainly divided into two types:
– Compile time Polymorphism : This type of polymorphism is
achieved by:
• Function overloading or
• Operator overloading
– Runtime Polymorphism : This type of polymorphism is achieved by
Function Overriding.
57Presented By: Tekendra Nath Yogi
Contd…
• Dynamic Binding:
– Binding Refers to linking of a procedure call to the code
to be executed in response to the call.
– Dynamic binding means that the code associated with a
given procedure call in not known until the time of call at
run-time.
– It is also known as late binding.
59Presented By: Tekendra Nath Yogi
Contd…
• Message Passing:
– An object-oriented program consist of a set of objects that
communicate with each other by sending and receiving
message.
– Message for an object is a request for execution of a
procedure and therefore will invoke a function in the
receiving object that generates the desired result.
60Presented By: Tekendra Nath Yogi
Contd…
• Advantages of OOPs:
– Code recycle and reuse.
– Easy to partition the work in a project based on objects. So, Software
Complexity can be easily handled and managed.
– Message passing technique between objects for communication makes
interface description with external systems much more straightforward.
– Possible to map objects in a problem domain within a program.
– Data hiding is possible.
– Use of inheritance can eliminate redundant codes in a program.
62Presented By: Tekendra Nath Yogi
Contd…
• Disadvantages of OOPs:
– Compile and runtime overhead.
– Re-orientation of software developer to object-oriented thinking.
– Requires the mastery in software engineering and programming
methodology.
– Benefits only in long run while managing large software projects.
– The message passing between many object in a complex application
can be difficult to trace and debug.
63Presented By: Tekendra Nath Yogi
Contd…
Structured Programming Object Oriented Programming
Structured Programming is designed which
focuses on procedure and then data required for
that procedure.
Object Oriented Programming is designed which
focuses on data.
Structured Programming is also known as Modular
Programming and a subset of procedural
programming language.
Object Oriented Programming supports inheritance,
encapsulation, abstraction, polymorphism, etc.
In Structured Programming, Programs are divided
into small self contained functions.
In Object Oriented Programming, Programs are
divided into small entities called objects.
Structured Programming is less secure as there is
no way of data hiding.
Object Oriented Programming is more secure as
having data hiding feature.
Structured Programming can
solve moderately complex programs.
Object Oriented Programming can solve
any complex programs.
Structured Programming provides less reusability,
more function dependency.
Object Oriented Programming provides more
reusability, less function dependency.
Less abstraction and less flexibility. More abstraction and more flexibility.
64Presented By: Tekendra Nath Yogi
Object-Based Programming
• The Fundamental idea behind object-based programming is the concept
of object ( the idea of encapsulating data and operations) where one or
more of the following restrictions apply:
– There is no implicit inheritance
– There is no polymorphism
– Only a very reduced subset of the available values are objects(Typically the
GUI components)
– E.g., Visual basic(VB)
65Presented By: Tekendra Nath Yogi
Homework
1. Explain characteristics and limitations of procedure-oriented programming?
How OOP overcome those limitations.
2. What is objected oriented programming? Explain objects, class,
encapsulation, data hiding, inheritance, and polymorphism.
3. Differentiate between structured programming and OOP
4. Compare and contrast between object oriented and object-based
programming languages with examples.
5. “Inheritance and polymorphism is important features of OOPs” explain and
justify this statement.
66Presented By: Tekendra Nath Yogi
Recommended Reading
• Robert Lafore, Chapter1: The Big Picture
CPS235: Introduction 67
Thank You !
68Presented By: Tekendra Nath Yogi

More Related Content

What's hot

Lexical Analysis
Lexical AnalysisLexical Analysis
Lexical AnalysisMunni28
 
Cs8092 computer graphics and multimedia unit 2
Cs8092 computer graphics and multimedia unit 2Cs8092 computer graphics and multimedia unit 2
Cs8092 computer graphics and multimedia unit 2SIMONTHOMAS S
 
Software Project Managment
Software Project ManagmentSoftware Project Managment
Software Project ManagmentSaqib Naveed
 
Software Project Management chapter-1
Software Project Management chapter-1Software Project Management chapter-1
Software Project Management chapter-1Computing Cage
 
2-Agents- Artificial Intelligence
2-Agents- Artificial Intelligence2-Agents- Artificial Intelligence
2-Agents- Artificial IntelligenceMhd Sb
 
Requirements analysis
Requirements analysisRequirements analysis
Requirements analysisasimnawaz54
 
Concurrent process
Concurrent processConcurrent process
Concurrent processYogendra Rwl
 
Digital Electronic and it application
Digital Electronic and it applicationDigital Electronic and it application
Digital Electronic and it applicationApurbo Datta
 
Traditional symmetric-key cipher
Traditional symmetric-key cipherTraditional symmetric-key cipher
Traditional symmetric-key cipherVasuki Ramasamy
 
Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3Akshay Nagpurkar
 
Object Oriented Programming Using C++ Practical File
Object Oriented Programming Using C++ Practical FileObject Oriented Programming Using C++ Practical File
Object Oriented Programming Using C++ Practical FileHarjinder Singh
 
Ll(1) Parser in Compilers
Ll(1) Parser in CompilersLl(1) Parser in Compilers
Ll(1) Parser in CompilersMahbubur Rahman
 
Artificial Intelligence: Knowledge Acquisition
Artificial Intelligence: Knowledge AcquisitionArtificial Intelligence: Knowledge Acquisition
Artificial Intelligence: Knowledge AcquisitionThe Integral Worm
 
Other software processes (Software project Management)
Other software processes (Software project Management)Other software processes (Software project Management)
Other software processes (Software project Management)Ankit Gupta
 
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddelCHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddelmohamed khalaf alla mohamedain
 
Lecture 4- Agent types
Lecture 4- Agent typesLecture 4- Agent types
Lecture 4- Agent typesAntonio Moreno
 

What's hot (20)

Lexical Analysis
Lexical AnalysisLexical Analysis
Lexical Analysis
 
Cs8092 computer graphics and multimedia unit 2
Cs8092 computer graphics and multimedia unit 2Cs8092 computer graphics and multimedia unit 2
Cs8092 computer graphics and multimedia unit 2
 
Software Project Managment
Software Project ManagmentSoftware Project Managment
Software Project Managment
 
C++ Overview PPT
C++ Overview PPTC++ Overview PPT
C++ Overview PPT
 
Software Project Management chapter-1
Software Project Management chapter-1Software Project Management chapter-1
Software Project Management chapter-1
 
2-Agents- Artificial Intelligence
2-Agents- Artificial Intelligence2-Agents- Artificial Intelligence
2-Agents- Artificial Intelligence
 
software engineering
software engineeringsoftware engineering
software engineering
 
Unit 6: Application of AI
Unit 6: Application of AIUnit 6: Application of AI
Unit 6: Application of AI
 
Requirements analysis
Requirements analysisRequirements analysis
Requirements analysis
 
Concurrent process
Concurrent processConcurrent process
Concurrent process
 
Digital Electronic and it application
Digital Electronic and it applicationDigital Electronic and it application
Digital Electronic and it application
 
Traditional symmetric-key cipher
Traditional symmetric-key cipherTraditional symmetric-key cipher
Traditional symmetric-key cipher
 
Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3
 
Object Oriented Programming Using C++ Practical File
Object Oriented Programming Using C++ Practical FileObject Oriented Programming Using C++ Practical File
Object Oriented Programming Using C++ Practical File
 
Ll(1) Parser in Compilers
Ll(1) Parser in CompilersLl(1) Parser in Compilers
Ll(1) Parser in Compilers
 
Artificial Intelligence: Knowledge Acquisition
Artificial Intelligence: Knowledge AcquisitionArtificial Intelligence: Knowledge Acquisition
Artificial Intelligence: Knowledge Acquisition
 
Text Editor in System software
Text Editor in System softwareText Editor in System software
Text Editor in System software
 
Other software processes (Software project Management)
Other software processes (Software project Management)Other software processes (Software project Management)
Other software processes (Software project Management)
 
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddelCHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
 
Lecture 4- Agent types
Lecture 4- Agent typesLecture 4- Agent types
Lecture 4- Agent types
 

Similar to CSC-161 Object Oriented Programming

SE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPTSE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPTnikshaikh786
 
Chapter12 python object oriented concepts.ppt
Chapter12 python object oriented concepts.pptChapter12 python object oriented concepts.ppt
Chapter12 python object oriented concepts.pptnaveenkumarkiot12
 
2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx
2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx
2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptxGauravGamer2
 
16613874-Object-Oriented-Programming-Presentation.ppt
16613874-Object-Oriented-Programming-Presentation.ppt16613874-Object-Oriented-Programming-Presentation.ppt
16613874-Object-Oriented-Programming-Presentation.pptvsdfg
 
01 introduction to cpp
01   introduction to cpp01   introduction to cpp
01 introduction to cppManzoor ALam
 
Oop(object oriented programming)
Oop(object oriented programming)Oop(object oriented programming)
Oop(object oriented programming)geetika goyal
 
chapter 1 software design.pptx
chapter 1 software design.pptxchapter 1 software design.pptx
chapter 1 software design.pptxrecoveraccount1
 
Functional Programming.pptx
Functional Programming.pptxFunctional Programming.pptx
Functional Programming.pptxKarthickT28
 
Chapter 3- Software Project Management(Reduced).ppt
Chapter 3- Software Project Management(Reduced).pptChapter 3- Software Project Management(Reduced).ppt
Chapter 3- Software Project Management(Reduced).pptpayelguria1
 
Kelis king - introduction to software design
Kelis king -  introduction to software designKelis king -  introduction to software design
Kelis king - introduction to software designKelisKing
 

Similar to CSC-161 Object Oriented Programming (20)

[OOP - Lec 01] Introduction to OOP
[OOP - Lec 01] Introduction to OOP[OOP - Lec 01] Introduction to OOP
[OOP - Lec 01] Introduction to OOP
 
Lecture 1 (bce-7)
Lecture   1 (bce-7)Lecture   1 (bce-7)
Lecture 1 (bce-7)
 
SE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPTSE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPT
 
Chapter12 python object oriented concepts.ppt
Chapter12 python object oriented concepts.pptChapter12 python object oriented concepts.ppt
Chapter12 python object oriented concepts.ppt
 
Chapter12.ppt
Chapter12.pptChapter12.ppt
Chapter12.ppt
 
2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx
2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx
2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx
 
16613874-Object-Oriented-Programming-Presentation.ppt
16613874-Object-Oriented-Programming-Presentation.ppt16613874-Object-Oriented-Programming-Presentation.ppt
16613874-Object-Oriented-Programming-Presentation.ppt
 
01 introduction to cpp
01   introduction to cpp01   introduction to cpp
01 introduction to cpp
 
6th sem
6th sem6th sem
6th sem
 
Oop(object oriented programming)
Oop(object oriented programming)Oop(object oriented programming)
Oop(object oriented programming)
 
DE PPT.pptx
DE PPT.pptxDE PPT.pptx
DE PPT.pptx
 
chapter 1 software design.pptx
chapter 1 software design.pptxchapter 1 software design.pptx
chapter 1 software design.pptx
 
Raising the Bar
Raising the BarRaising the Bar
Raising the Bar
 
Functional Programming.pptx
Functional Programming.pptxFunctional Programming.pptx
Functional Programming.pptx
 
OOP-1.pptx
OOP-1.pptxOOP-1.pptx
OOP-1.pptx
 
Yogesh_job_resume
Yogesh_job_resumeYogesh_job_resume
Yogesh_job_resume
 
Chapter 3- Software Project Management(Reduced).ppt
Chapter 3- Software Project Management(Reduced).pptChapter 3- Software Project Management(Reduced).ppt
Chapter 3- Software Project Management(Reduced).ppt
 
C programming
C programmingC programming
C programming
 
Kelis king - introduction to software design
Kelis king -  introduction to software designKelis king -  introduction to software design
Kelis king - introduction to software design
 
ProgrammingPrimerAndOOPS
ProgrammingPrimerAndOOPSProgrammingPrimerAndOOPS
ProgrammingPrimerAndOOPS
 

More from Tekendra Nath Yogi

Unit4: Knowledge Representation
Unit4: Knowledge RepresentationUnit4: Knowledge Representation
Unit4: Knowledge RepresentationTekendra Nath Yogi
 
Unit3:Informed and Uninformed search
Unit3:Informed and Uninformed searchUnit3:Informed and Uninformed search
Unit3:Informed and Uninformed searchTekendra Nath Yogi
 
BIM Data Mining Unit5 by Tekendra Nath Yogi
 BIM Data Mining Unit5 by Tekendra Nath Yogi BIM Data Mining Unit5 by Tekendra Nath Yogi
BIM Data Mining Unit5 by Tekendra Nath YogiTekendra Nath Yogi
 
BIM Data Mining Unit4 by Tekendra Nath Yogi
 BIM Data Mining Unit4 by Tekendra Nath Yogi BIM Data Mining Unit4 by Tekendra Nath Yogi
BIM Data Mining Unit4 by Tekendra Nath YogiTekendra Nath Yogi
 
BIM Data Mining Unit3 by Tekendra Nath Yogi
 BIM Data Mining Unit3 by Tekendra Nath Yogi BIM Data Mining Unit3 by Tekendra Nath Yogi
BIM Data Mining Unit3 by Tekendra Nath YogiTekendra Nath Yogi
 
BIM Data Mining Unit2 by Tekendra Nath Yogi
 BIM Data Mining Unit2 by Tekendra Nath Yogi BIM Data Mining Unit2 by Tekendra Nath Yogi
BIM Data Mining Unit2 by Tekendra Nath YogiTekendra Nath Yogi
 
BIM Data Mining Unit1 by Tekendra Nath Yogi
 BIM Data Mining Unit1 by Tekendra Nath Yogi BIM Data Mining Unit1 by Tekendra Nath Yogi
BIM Data Mining Unit1 by Tekendra Nath YogiTekendra Nath Yogi
 
B. SC CSIT Computer Graphics Unit 5 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 5 By Tekendra Nath YogiB. SC CSIT Computer Graphics Unit 5 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 5 By Tekendra Nath YogiTekendra Nath Yogi
 
B. SC CSIT Computer Graphics Lab By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Lab By Tekendra Nath YogiB. SC CSIT Computer Graphics Lab By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Lab By Tekendra Nath YogiTekendra Nath Yogi
 

More from Tekendra Nath Yogi (20)

Unit9:Expert System
Unit9:Expert SystemUnit9:Expert System
Unit9:Expert System
 
Unit7: Production System
Unit7: Production SystemUnit7: Production System
Unit7: Production System
 
Unit8: Uncertainty in AI
Unit8: Uncertainty in AIUnit8: Uncertainty in AI
Unit8: Uncertainty in AI
 
Unit5: Learning
Unit5: LearningUnit5: Learning
Unit5: Learning
 
Unit4: Knowledge Representation
Unit4: Knowledge RepresentationUnit4: Knowledge Representation
Unit4: Knowledge Representation
 
Unit3:Informed and Uninformed search
Unit3:Informed and Uninformed searchUnit3:Informed and Uninformed search
Unit3:Informed and Uninformed search
 
Unit2: Agents and Environment
Unit2: Agents and EnvironmentUnit2: Agents and Environment
Unit2: Agents and Environment
 
Unit1: Introduction to AI
Unit1: Introduction to AIUnit1: Introduction to AI
Unit1: Introduction to AI
 
Unit10
Unit10Unit10
Unit10
 
Unit9
Unit9Unit9
Unit9
 
Unit8
Unit8Unit8
Unit8
 
Unit7
Unit7Unit7
Unit7
 
BIM Data Mining Unit5 by Tekendra Nath Yogi
 BIM Data Mining Unit5 by Tekendra Nath Yogi BIM Data Mining Unit5 by Tekendra Nath Yogi
BIM Data Mining Unit5 by Tekendra Nath Yogi
 
BIM Data Mining Unit4 by Tekendra Nath Yogi
 BIM Data Mining Unit4 by Tekendra Nath Yogi BIM Data Mining Unit4 by Tekendra Nath Yogi
BIM Data Mining Unit4 by Tekendra Nath Yogi
 
BIM Data Mining Unit3 by Tekendra Nath Yogi
 BIM Data Mining Unit3 by Tekendra Nath Yogi BIM Data Mining Unit3 by Tekendra Nath Yogi
BIM Data Mining Unit3 by Tekendra Nath Yogi
 
BIM Data Mining Unit2 by Tekendra Nath Yogi
 BIM Data Mining Unit2 by Tekendra Nath Yogi BIM Data Mining Unit2 by Tekendra Nath Yogi
BIM Data Mining Unit2 by Tekendra Nath Yogi
 
BIM Data Mining Unit1 by Tekendra Nath Yogi
 BIM Data Mining Unit1 by Tekendra Nath Yogi BIM Data Mining Unit1 by Tekendra Nath Yogi
BIM Data Mining Unit1 by Tekendra Nath Yogi
 
Unit6
Unit6Unit6
Unit6
 
B. SC CSIT Computer Graphics Unit 5 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 5 By Tekendra Nath YogiB. SC CSIT Computer Graphics Unit 5 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 5 By Tekendra Nath Yogi
 
B. SC CSIT Computer Graphics Lab By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Lab By Tekendra Nath YogiB. SC CSIT Computer Graphics Lab By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Lab By Tekendra Nath Yogi
 

Recently uploaded

URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 

Recently uploaded (20)

Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 

CSC-161 Object Oriented Programming

  • 1. College of applied Business(CAB) And Technology Course Name Object Oriented Programming (CSC-161) Faculty Name Mr. Tekendra Nath Yogi Tekendranath@gmail.com
  • 2. Course Title: Design and Analysis of Algorithms • Course no: CSC- 161 Full Marks: 60+20+ 20 • Credit hours: 3 Pass Marks: 24+ 8 +8 • Nature of course: Theory + Lab • Course Description: – The course covers the basic concepts of object oriented programming using C++ programming language. • Course Objectives: – The main objective of this course is to understand object oriented programming and advanced C++ concepts such as composition of objects, operator overloads, inheritance and polymorphism, file I/O, exception handling and templates. 2Presented By: Tekendra Nath Yogi
  • 3. Course Contents: • Unit 1: Introduction to Object Oriented Programming (3 Hrs.) – Overview of structured programming approach. – Problems with structured programming. – Object oriented programming approach – Characteristics of object oriented languages • Objects • Classes • Data abstraction and encapsulation • Polymorphism • Overloading • inheritance 3Presented By: Tekendra Nath Yogi
  • 4. Contd… • Unit 2: Basics of C++ programming (5 Hrs.) – C++ Program Structure – Character Set and Tokens(Keywords, identifiers, constants, operators, special symbols) – Data Type ( Basic types, derived types, and user defined types) – Type Conversion( Explicit conversion(Type cast operator), Implicit conversion) – Preprocessor Directives( include and define directives) 4Presented By: Tekendra Nath Yogi
  • 5. Contd… • Namespace • Input/Output Streams (Cin and Cout) and Manipulators ( setw and endl) • Dynamic Memory Allocation with new and delete • Control Statements(abstract review of decision making and branching, decision making and looping). • Functions: Function Overloading (different number of arguments, different types of argument) • Inline Functions • Default Argument • Pass by Reference • Return by Reference 5Presented By: Tekendra Nath Yogi
  • 6. Contd… • Scope (local, file, and class) and Storage Class. • Pointers: Pointer variables declaration & initialization, Operators in pointers(Address-of and value-at- the- address) • Pointers and Arrays, • Pointer and Function(Passing simple variables, passing arrays). 6Presented By: Tekendra Nath Yogi
  • 7. Contd… • Unit 3: Classes & Objects (8 Hrs.) – A Simple Class and Object (class definition: data member and function member) – Accessing members of class – Initialization of class objects: (Constructor, Destructor) – Default Constructor, Parameterized Constructor, Copy Constructor, The Default Copy Constructor, – destructor 7Presented By: Tekendra Nath Yogi
  • 8. Contd… – Objects as Function Arguments, – Returning Objects from Functions, – Structures and Classes, – Memory allocation for Objects, – Static members, – Member functions defined outside the class (Using scope resolution operator). 8Presented By: Tekendra Nath Yogi
  • 9. Contd… • Unit 4: Operator Overloading (7 Hrs.) – Fundamental of operator overloading, Restriction on operator overloading, Operator functions as a class members, – Overloading unary and binary operator, – Data Conversion (basic to basic, basic to user-defined, user-defined to basic, user-defined to user-defined) 9Presented By: Tekendra Nath Yogi
  • 10. Contd… • Unit 5: Inheritance (7 Hrs.) – Introduction to inheritance, Derived Class and Base Class, – Access Specifiers (private, protected, and public), – Types of inheritance(simple, multiple, hierarchical, multi-level, hybrid) – Public and Private Inheritance, – Constructor and Destructor in derived classes, – Aggregation (class with in class) 10Presented By: Tekendra Nath Yogi
  • 11. Contd… • Unit 6: Virtual Function, Polymorphism, and miscellaneous C++ Features (5 Hrs.) – Concept of Virtual functions (difference between normal member function accessed with pointers and virtual member function accessed with pointer) – Late Binding, Abstract class and pure virtual functions – Virtual Destructors, Virtual base class – Friend function(friend class) and Static function, – Assignment and copy initialization, Copy constructor, – This pointer, – Concrete classes(vs. abstract class), – Polymorphism and its roles. 11Presented By: Tekendra Nath Yogi
  • 12. Contd… • Unit 7: Function Templates and Exception Handling (4 Hrs.) – Function templates – Function templates with multiple arguments – Class templates – templates and inheritance – Exceptional Handling (Try, throw and catch) – Use of exceptional handling. 12Presented By: Tekendra Nath Yogi
  • 13. Contd… • Unit 8: File handling (6 Hrs.) – Stream Class Hierarchy for Console Input /Output, – Unformatted Input /Output, – Formatted Input /Output with ios Member functions, – Formatting with Manipulators, – Stream Operator Overloading, – File Input/output with Streams, 13Presented By: Tekendra Nath Yogi
  • 14. Contd… – Opening and Closing files (open() and close() member function) – Read/Write from File ( put() and get(), read(), and write(), member functions) – File Access Pointers and their Manipulators (seeks(), seekp(), tellg(), tellP(), offset, and etc..) – Sequential and Random Access to File, – Testing Errors during File Operations (eof(), fail(),bad(), good()) 14Presented By: Tekendra Nath Yogi
  • 15. Laboratory Works • Students should be able to implement the concepts of Object Oriented Programming using C++ language. 15Presented By: Tekendra Nath Yogi
  • 16. Text Books • Robert Lafore, Object Oriented Programming in C++, Fourth Edition, SAMS publications. • Herbert Schildt, C++ The Complete Reference, Fourth Edition, Tata McGraw Hill Publication. 16Presented By: Tekendra Nath Yogi
  • 17. Reference Books • Deitel and Deitel, C++ How to Program, Third Edition, Pearson Publication. • Joyce Farrell, Object-oriented programming using C++, Fourth Edition, Cengage Learning. 17Presented By: Tekendra Nath Yogi
  • 18. Model Question F.M.: 60 P.M.: 24 Section A(Long Answer questions): Attempt any two questions [2*10= 20] – 1. – 2. – 3. • Section B(Short Answer questions): Attempt any eight questions [8*5=40] – 4. – 5. – 6. – 7. – 8. – 9. – 10. – 11. – 12. 18Presented By: Tekendra Nath Yogi
  • 19. Unit1: Introduction to objected oriented programming • Programming: – The art and science of creating programs – Art: application of human creative skill and imagination. – Science: systematic study through observation and experiment. • So, to be a good programmer you should do a lot of experiment and observation of programs by using your own creative skill and imagination. 19Presented By: Tekendra Nath Yogi
  • 20. Contd… • Program: – Program outlines exactly the steps needed to perform a certain task. – E.g., Add two numbers 20Presented By: Tekendra Nath Yogi
  • 21. Contd… • Programming language: – A programming language is a tool used by programmers for instructing a computer or computing device to perform specific tasks. 21Presented By: Tekendra Nath Yogi
  • 22. Contd… • Classification Of Programming Languages: – Machine Language: • use 0 and 1 to express the instructions to perform a certain task. – Assembly Language: • This language uses symbols to express the instructions to perform the certain task. – High-level language: • This language uses mostly high level language like statement to express the instructions to perform a certain task. 22Presented By: Tekendra Nath Yogi
  • 23. Contd.. • The Top Programming Languages? – IEEE Ranking of programming language: 23Presented By: Tekendra Nath Yogi
  • 24. Programming Paradigms • Program organizing principles are called programming paradigms. • Following are the five types of programming paradigm: – Unstructured programming – Procedural programming – Structured programming – Object-oriented programming – Object-based programming 24Presented By: Tekendra Nath Yogi
  • 25. Contd… • Unstructured Programming paradigm: – A Technique for organizing and coding computer programs in which programmers put all their code in one program. 25Presented By: Tekendra Nath Yogi
  • 26. Contd… • This programming technique provides tremendous disadvantages (duplicacy and redundancy of code, code maintenance problem, readability and many more ) once the program gets sufficiently large • For example, if the same statement sequence is needed at different locations within the program, the sequence must be copied. • This has lead to the idea of extracting these sequences, naming them and offering a technique to call and return from these procedures. i.e., Reuse the same code at different places in the program without copying it. 26Presented By: Tekendra Nath Yogi
  • 27. Contd… • Procedural Programming: – Combine returning sequences of statements into one single place – A procedure call is used to invoke the procedure – After the sequence is processed, flow of control proceeds right after the position where the call was made 27Presented By: Tekendra Nath Yogi
  • 28. Contd… • With the introduction of parameters as well as procedures of procedures ( sub- procedures) programs can now be written more structured and error free – For example, if a procedure is correct, every time it is used it produces correct results • The main program is responsible to pass data to the individual calls, the data is processed by the procedures and, once the program has finished, the resulting data is presented 28Presented By: Tekendra Nath Yogi
  • 29. Contd… • Now we have a single program which is divided into small pieces called procedures • To enable usage of general procedures or groups of procedures also in other programs, they must be separately available • For that reason, modular programming allows grouping of procedures into modules 29Presented By: Tekendra Nath Yogi
  • 30. Contd… • Structured Programming (Modular Programming) Paradigm: – During the 1970s it became clear that even well-structured programs were not enough for mastering the complexity involved in developing a large program system – It was also recognized that it was necessary to support the division of the program into well-defined parts or modules, that could be developed and tested independently of one another, so that several people could work together within one large programming project – Modular programming (subset of procedural programming)is thus concerned with the subdivision of programs into manageable "chunks" 30Presented By: Tekendra Nath Yogi
  • 31. Contd… • With modular programming procedures of a common functionality are grouped together into separate modules • A program therefore no longer consists of only one single part. • It is now divided into several smaller parts which interact through procedure calls and which form the whole program 31Presented By: Tekendra Nath Yogi
  • 32. Contd… • Each module can have its own data. This allows each module to manage an internal state which is modified by calls to procedures of this module 32Presented By: Tekendra Nath Yogi
  • 33. Contd… 33Presented By: Tekendra Nath Yogi CPS235: Introduction 33 Unstructured, procedural, modular programming Unstructured programming. The main program directly operates on global data Procedural programming. The main program coordinates calls to procedures and hands over appropriate data as parameters Modular programming. The main program coordinates calls to procedures in separate modules and hands over appropriate data as parameters
  • 34. Contd… • Features of structured programming: – Emphasis is given on algorithm rather than on data. – Large programs are divided into smaller programs known as functions and functions are grouped into modules. – Most of the functions share global data. – Data move openly around the system from function to function. 34Presented By: Tekendra Nath Yogi
  • 35. Contd… • Advantages of structured programming: The following are the major advantages of structured programming. – Reduced complexity – Increased productivity – portability 35Presented By: Tekendra Nath Yogi
  • 36. Contd… • Problems with structured programming: Some problems with structured programming are: – Complexity of managing large projects – Data under-valued – Relationship to real world – New data types 36Presented By: Tekendra Nath Yogi
  • 37. Contd… • Complexity of managing large projects: – As programs grow larger, even structured programming approach begins to show signs of strain. – No matter how well the structured programming approach is implemented, the project becomes too complex, the schedule slips, more programmers are needed, and costs skyrocket. 37Presented By: Tekendra Nath Yogi
  • 38. Contd… • Data Undervalued: – Data is given second-class status in the organization of procedural languages. – A global data can be corrupted by functions. Since many functions access the same global data, the way the data is stored becomes critical. 38Presented By: Tekendra Nath Yogi
  • 39. Contd… • Relationship to the Real World: – Procedural programs are often difficult to design because their chief components – functions and data structures – don’t model the real world very well. 39Presented By: Tekendra Nath Yogi
  • 40. Contd… • New Data Types: – It is difficult to create new data types with procedural languages. – Furthermore, most Procedural languages are not usually extensible and hence procedural programs are more complex to write and maintain. 40Presented By: Tekendra Nath Yogi The problems faced in the structured programming approach are the motivating factor in the invention of objected oriented approach.
  • 41. Contd… • Object Oriented Programming(OOP) Paradigm: • In the OOP approach, data and the functions, which are supposed to have the access to the data, are packed together into a single unit known as an object • An objected-oriented program may thus consists of number of objects . • Each Objects of the program is capable of receiving message, processing data , and sending messages to other objects thus, can be viewed as an independent machine with a distinct role and responsibility. 41Presented By: Tekendra Nath Yogi
  • 42. Characteristics(features) of object oriented languages: • Different features of object oriented programming are: – Objects – Classes – abstraction – Encapsulation – Inheritance – Polymorphism – Message passing 42Presented By: Tekendra Nath Yogi
  • 43. Contd… • Objects: – Objects are the basic run- time entities in an object-oriented program. – They may represent a person, place, table etc. They are identified by its unique name. – An object represents a particular instance of a class. There can be more than one instance. – Each object contains data and code to manipulate the data. So, they occupy space in memory. 43Presented By: Tekendra Nath Yogi
  • 44.
  • 45.
  • 46. Contd… • Classes: – Collection of objects is called class. It is a logical entity. So, it does not occupy space. – Classes are user defined data types and objects are variables of class. – Once a class has been defined we can create any number of objects for that class 46Presented By: Tekendra Nath Yogi
  • 47.
  • 48. Contd… • Abstraction: – Abstraction means the representation of the essential features without providing the internal details and complexities. • For example: phone call, we don't know the internal processing. – In OOP, abstraction is achieved by the help of class, where data and methods are combined to extract the essential features only. 48Presented By: Tekendra Nath Yogi
  • 50. Contd… • Encapsulation: – Encapsulation is the process of combining the data (called fields or attributes) and functions (called methods or behaviors) into a single framework called class. – Encapsulation helps preventing the modification of data from outside the class by properly assigning the access privilege to the data inside the class. – So the term data hiding is possible due to the concept of encapsulation, since the data are hidden from the outside world. 50Presented By: Tekendra Nath Yogi
  • 51.
  • 52. Contd… • Inheritance: – Inheritance is the process of acquiring certain attributes and behaviors from parents. • For examples, cars, trucks, buses, and motorcycles inherit all characteristics of vehicles. 52Presented By: Tekendra Nath Yogi
  • 53.
  • 54.
  • 55. Contd… – Object-oriented programming allows classes to inherit commonly used data and functions from other classes. – If we derive a class(called derived class) from another class (called base class), some of the data and functions can be inherited so that we can reuse the already written and tested code in our program, simplifying our program. 55Presented By: Tekendra Nath Yogi
  • 56. Contd… • Polymorphism: – The word polymorphism means having many forms. – Real life example of polymorphism, a person at a same time can have different characteristic. Like a man at a same time is a father, a husband, a employee. So a same person posses have different behavior in different situations. This is called polymorphism. 56Presented By: Tekendra Nath Yogi
  • 57. Contd… • Polymorphism is considered as one of the important features of Object Oriented Programming. • In C++ polymorphism is mainly divided into two types: – Compile time Polymorphism : This type of polymorphism is achieved by: • Function overloading or • Operator overloading – Runtime Polymorphism : This type of polymorphism is achieved by Function Overriding. 57Presented By: Tekendra Nath Yogi
  • 58.
  • 59. Contd… • Dynamic Binding: – Binding Refers to linking of a procedure call to the code to be executed in response to the call. – Dynamic binding means that the code associated with a given procedure call in not known until the time of call at run-time. – It is also known as late binding. 59Presented By: Tekendra Nath Yogi
  • 60. Contd… • Message Passing: – An object-oriented program consist of a set of objects that communicate with each other by sending and receiving message. – Message for an object is a request for execution of a procedure and therefore will invoke a function in the receiving object that generates the desired result. 60Presented By: Tekendra Nath Yogi
  • 61.
  • 62. Contd… • Advantages of OOPs: – Code recycle and reuse. – Easy to partition the work in a project based on objects. So, Software Complexity can be easily handled and managed. – Message passing technique between objects for communication makes interface description with external systems much more straightforward. – Possible to map objects in a problem domain within a program. – Data hiding is possible. – Use of inheritance can eliminate redundant codes in a program. 62Presented By: Tekendra Nath Yogi
  • 63. Contd… • Disadvantages of OOPs: – Compile and runtime overhead. – Re-orientation of software developer to object-oriented thinking. – Requires the mastery in software engineering and programming methodology. – Benefits only in long run while managing large software projects. – The message passing between many object in a complex application can be difficult to trace and debug. 63Presented By: Tekendra Nath Yogi
  • 64. Contd… Structured Programming Object Oriented Programming Structured Programming is designed which focuses on procedure and then data required for that procedure. Object Oriented Programming is designed which focuses on data. Structured Programming is also known as Modular Programming and a subset of procedural programming language. Object Oriented Programming supports inheritance, encapsulation, abstraction, polymorphism, etc. In Structured Programming, Programs are divided into small self contained functions. In Object Oriented Programming, Programs are divided into small entities called objects. Structured Programming is less secure as there is no way of data hiding. Object Oriented Programming is more secure as having data hiding feature. Structured Programming can solve moderately complex programs. Object Oriented Programming can solve any complex programs. Structured Programming provides less reusability, more function dependency. Object Oriented Programming provides more reusability, less function dependency. Less abstraction and less flexibility. More abstraction and more flexibility. 64Presented By: Tekendra Nath Yogi
  • 65. Object-Based Programming • The Fundamental idea behind object-based programming is the concept of object ( the idea of encapsulating data and operations) where one or more of the following restrictions apply: – There is no implicit inheritance – There is no polymorphism – Only a very reduced subset of the available values are objects(Typically the GUI components) – E.g., Visual basic(VB) 65Presented By: Tekendra Nath Yogi
  • 66. Homework 1. Explain characteristics and limitations of procedure-oriented programming? How OOP overcome those limitations. 2. What is objected oriented programming? Explain objects, class, encapsulation, data hiding, inheritance, and polymorphism. 3. Differentiate between structured programming and OOP 4. Compare and contrast between object oriented and object-based programming languages with examples. 5. “Inheritance and polymorphism is important features of OOPs” explain and justify this statement. 66Presented By: Tekendra Nath Yogi
  • 67. Recommended Reading • Robert Lafore, Chapter1: The Big Picture CPS235: Introduction 67
  • 68. Thank You ! 68Presented By: Tekendra Nath Yogi