Chap 1
Chap 1
CONTENTS
Object Oriented Programming
Concept Of Object Oriented Programming
Basic Object-Oriented Programming
Data Members
Members Function
Advantages of OOPs
Simple String Program
Simple Integer Program
Simple Character Program
Simple Float Program
Concept Of Object Oriented Programming
Coop is a Programming pattern where the programs are structured around objects rather than
functions and logic.
It makes the data partitioned into two memory areas, i.e., data and functions, and helps make
the code flexible and modular.
Object-oriented programming mainly focuses on objects that are required to be manipulated.
In OOPs, it can represent data as objects that have attributes and functions.
Object Oriented Programming
Basic Object-Oriented Programming
Object-An O Object can be defined as an entity that has a state and behavior is called an
object.
It can represent a dog, a person, a table, etc.
An object means the combination of data and programs, which further represent an entity.
Dynamic binding means the code associated with a given procedure call is not
known until the time of the call at run-time.
A message for an object is a request for execution of a procedure and therefore will
invoke a function (procedure) in the receiving object that generates the desired
result.
Message passing involves specifying the name of the object, the name of the
function (message) and information to be sent.
MESSAGE PASSING
Data Members And Member Functions
• Data members are the data variables.
• Member functions are the functions used to affect these variables and together these data members
and member functions defines the properties and behavior of the objects in a Class.
Advantages of OOPs
Real business systems are often much more complex and contain many more objects with
complicated attributes and methods.
OOP is useful in this type of applications because it can simplify a complex problem.
int main()
{
int var1, var2;
Int var1 = 20;
var2 = var1 + 10 ;
cout << "var2 is = ";
cout << var2<<endl;
return 0;
}
Simple Character Program
#include<iostream>
using namespace std;
int main()
{
char charvar1 = 'A';
char chrvar2 = '\t’;
//charvar1 = 'B';
cout << charvar1;
cout << '\n';
return 0;
}
Simple Float Program
#include <iostream>
using namespace std;
int main()
{
return 0;
}