3. Quiz 1
What is a programming language?
A programming language is a formal
language that specifies a set of instructions that
can be used to produce various kinds of output.
A language used by programmers to write
instructions that a computer can understand to do
what the programmer (or the computer user) wants.
4. Procedural Programming Techniques
Focuses on Functions.
Data items are defined as global.
All functions access the global data item freely.
Each function is having its own local data.
It employs top-down approach.
6. Quiz 2
Give example of procedural language.
C, FORTRAN, Pascal....
Who developed C language?
Dennis Ritchie
7. Object Oriented Programming
Focuses on Data.
Problem is decomposed into number entities
called objects.
Data is not defined as global
Data of an object can be accessed by the
functions associated with that object.
Functions of one object can access functions of
other objects.
9. Procedural Vs Object Oriented
Procedural Programming Object Oriented Programming
Focuses on Functions Focuses on Data
Uses/ define Global data Data is not defined as global
Functions access same data item Only the functions associated with
the object can access the data
item.
Top down approach Bottom up approach
10. Quiz 3
Give examples of Object Oriented
Languages.
C++, Java, C# ......
Who developed C++?
Bjarne Stroustrup
12. Objects
OBJECT
DATA
Objects are the basic run-time
entities in an object oriented system.
For eg: person, bank account, an
FUNCTIONS
item.
Objects interacts with other objects
by sending messages to one another.
Each object consists of data items
and the functions to manipulate that
data.
13. Classes
A class is a collection of objects of similar type.
It is a user defined data type.
Object are variables of the type class.Object are variables of the type class.
For eg: mango, apple, orange are the objects of
fruit class.
Once the class is defined we can create any
number of objects.
14. Data Abstraction & Encapsulation
Wrapping up of data and functions into a single
unit is known as Encapsulation. Eg: quadratic
equations.
Abstraction refers to the act of representing
essential features without including the
background details. Eg: automobile company.
15. Inheritance
Inheritance is the process by which objects of
one class acquire the properties of objects of
another class.another class.
The concept of inheritance provides the idea of
reusability.
Class animals is divided into mammals,
amphibians, insects, birds etc.
17. Polymorphism
Polymorphism means the ability to take
more than one form.
In oops it is achieved through:
Operator Overloading
Function Overloading.
18. Operator Overloading
The process of making an operator to
exhibit different behaviors in different
instances is known as operator
overloading.
Addition operation example.
19. Function Overloading
Shape
Using the same function name to perform
different type of tasks is known as function
overloading.
Draw()
Box Object
Draw(Box)
Triangle Object
Draw(Triangle)
Circle Object
Draw(Circle)
20. Dynamic Binding
Binding refers to the linking of a procedure
call to the code to be executed in
response to a call.
Dynamic Binding means the code
associated with the call is not known until
the time of the call at run-time.
21. Message Passing
A message for an object is a request for
execution of a procedure.
Message passing involves specifying the
name of the object, the name of the
function and the information to be sent.
employee.salary(name)
22. Features of OOPs
Emphasis is on data rather than procedure.
Programs are divided into objects.
Data structures are designed such that they characterise
the objects.
Functions that operate on data of an object are tiedFunctions that operate on data of an object are tied
together in the data structure.
Data is hidden and cannot be accessed by external
functions.
Objects may communicate with each other through
functions.
New data and functions can be easily added whenever
necessary.
Follows bottom up approach in program design.
23. Benefits of OOP
Modularity for easier troubleshooting
Reuse of code through inheritanceReuse of code through inheritance
Flexibility through polymorphism
Effective problem solving
24. Applications of OOP
Real time systems
Simulation and Modelling
Object Oriented Databases
AI and Expert Systems
Neural Network and parallel programming
Decision support and automation systems.
25. First C++ Program
# include<iostream.h>
using namespace std;
int main()int main()
{
cout<<“Hello World”;
return 0;
}
26. C Vs C++ Program
C Program
# include <stdio.h>
main()
C++ Program
# include <iostream>
using namespace std;
main()
{
printf(“Hello World”);
}
int main()
{
cout<< “ Hello World”;
return 0;
}
27. C++ Program with Class
# include<iostream>
using namespace std;
class person
{
char name[30];
int age;
public:
void person :: display(void)
{
cout << “n Name : “ << name;
cout << “n Age : “ << age;
}
int main()public:
void getdata(void);
void display(void);
};
void person :: getdata(void)
{
cout<< “ Enter Name : “;
cin>> name;
cout<<“ Enter Age : “;
cin>> age;
}
int main()
{
person p;
p.getdata();
p.display();
return 0 ;
}
28. Structure of C++ Program
Include Files
Class declaration
Member functions definitions
Main function Program
29. Summary
OOPs focuses on ____________.
________ is a run time entity.
Class is also known as _____________.
________ provides the idea of reusability.________ provides the idea of reusability.
Objects can communicate with each other
through _________.
Polymorphism is achieved through ________
and __________.