oop cocepts
TRANSCRIPT
Anu. S
www.facebook.com/Anu Sasidharan
twitter.com/username
in.linkedin.com/in/profilename
OOPS CONCEPTS IN C++
Disclaimer: This presentation is prepared by trainees ofbaabtra as a part of mentoring program. This is not officialdocument of baabtra –Mentoring PartnerBaabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
CONTENTS
OBJECT ORIENTED PROGRAMMING
DATA ABSTRACTION
INHERITANCE
DATA ENCAPSULATION
POLYMORPHISM
EXAMPLE
OBJECT ORIENTED
PROGRAMMING
Object oriented programming approach views a
problem in terms of objects involved.
OBJECTS
An OBJECT is an identifiable entity with some
characteristics and behaviour.
Example: Orange
Characteristics: spherical shapeorange colour
Behaviour: juicytastes sweet-sour
CLASS
A CLASS is a group of objects that share common
properties and relationships
Example: a CAR can be considered as
a class.
Objects in this class involves the
steering,wheels,engine.
Properties involve the
company,color,model,speed,engine
capacity,etc
EXAMPLE
class CS{
int studentid;
char name[100];
int totmks=0;
float avg;
int total(int marks[5])
{
for(i=0;i<5;i++)
{
totmks+=marks[i];
avg=totmks/5;
}
return balance;
}
};
class
objects CS stud1,stud2;
DATA ABSTRACTION
The act of representing essential features without including the background details or explanations.
Example:
A calculator
Only the results are displayed on the
screen
The user is unaware of its internal
processing
INHERITANCE
The capability of one class of things to inherit capabilities or properties from another class.
EXAMPLES
#include<iostream.h>class Item{
int itemno;float price;
public:void getdata(int i,float j){
itemno=i;price=j;
}};
const int size=10;Item order[size];int main(){
int ino;float cost;//get value for all itemsfor(int a=0;a<size;a++){
cout<<"Enter itemno & price for item"<<a+1<<"\n";cin>>ino>>cost;order[a].getdata(ino,cost);
}return 0;}
Item 1Itemno:111 price:155Item 2Itemno:125 price:89Item 3Itemno:201 price:95Item 4Itemno:352 price:213Item 5Itemno:444 price:250
Want to learn more about programming or Looking tobecome a good programmer? Are you wasting time onsearching so many contents online? Do you want to learnthings quickly? Do an online course @ baabtra.com. Weprovide development, testing and production environmentsjust like in the industry to practice. The courses are sostructured to make a quick, good software professional.
Follow us @ twitter.com/baabtra
Like us @ facebook.com/baabtra
Subscribe to us @ youtube.com/baabtra
Become a follower @ slideshare.net/BaabtraMentoringPartner
Connect to us @ in.linkedin.com/in/baabtra
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
Contact Us
Emarald Mall (Big Bazar Building)Mavoor Road, Kozhikode,Kerala, India.Ph: + 91 – 495 40 25 550
NC Complex, Near Bus StandMukkam, Kozhikode,Kerala, India.Ph: + 91 – 495 40 25 550
Cafit Square,Hilite Business Park,Near Pantheerankavu,Kozhikode
Start up VillageEranakulam,Kerala, India.
Email: [email protected]