oop concept

27

Upload: baabtracom-no-1-supplier-of-quality-freshers

Post on 12-Jul-2015

487 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Oop concept
Page 2: Oop concept

Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd

Page 3: Oop concept

Week Target Achieved

1 30 23

2

3

Typing Speed

Page 4: Oop concept

Jobs Applied

Week Company Designation Applied Date Current Status

1

2

3

Page 5: Oop concept

OOP Concepts

Muhammed Ajmal [email protected] www.facebook.com/username twitter.com/username in.linkedin.com/in/profilename 9745020951

Page 6: Oop concept

Overview

• Introduction

• Class

• Object

• Encapsulation

• Abstraction

• Inheritance

• Polymorphism

Page 7: Oop concept

Introduction

• OOP is a design philosophy

• Stands for Object Oriented Programing

Page 8: Oop concept

Object

• Any thing that really exist in the world

• a table, a car, a dog, a person, etc.

• It has some properties

• It has some action

Page 9: Oop concept

class

• Classes provide the structure for objects

• It is a blue print

• It does not exist physically

Page 10: Oop concept

Encapsulation

• The Wrapping of data and function into a

single unit

• It is also known as information-hiding

• It is the way of implementing abstraction

Page 11: Oop concept

example

Class A

{

Int a;

Public int get()

{Return a;}

Public void set()

{a=10;}

}

Page 12: Oop concept

Abstraction

• Data abstraction refers to, providing only essential

information to the user.

• Hide unnecessary data from the user.

class Bank

{

private int accno;

private String name;

private float Balance;

Page 13: Oop concept

Abstraction contd.

private float Profit;

private float Loan;

public void display_to_clerk()

{

cout<<accountno<<Name<<Balnce)

}

Public void display()

{//display all }

}

Page 14: Oop concept

Inheritance

• Mechanism of deriving a new class from an already

existing class.

• 5 types of inheritance

– Single level

– Multilevel

– Multiple Hierarchical

– Hybrid

Page 15: Oop concept

Inheritance cont.

Page 16: Oop concept

Inheritance contd.

Page 17: Oop concept

Polymorphism

• `one name, multiple forms

Page 18: Oop concept

Function Overloading

• Two or more function with same name but different function

• Differentiated by signature Class sample

{

Void add(int a,int b)

{

cout<<a+b;

}

Void add(int a,int b,int c)

{

cout<<a+b+c;}

}

Page 19: Oop concept

Example contd.

Int main()

{

Sample s;

S.add(5,10);

S.add(5,10,15);

}

Output

15

30

Page 20: Oop concept

Program using class class Student

{

public:

char Dob[15];

int marks[5];

int age;

int rollNo;

float avg;

char Name[19];

int total=0;

void setdata()

{

cout<<"\nRollNo: ";

cin>>rollNo;

cout<<"\n Name:";

cin>>Name;

cout<<"\nDOb";

cin>>Dob;

cout<<"Age";

cin>>age;

Page 21: Oop concept

for(int i=0;i<5;i++) { cout<<"mark"<<i+1<<": "; cin>>marks[i]; total=total+marks[i]; cout<<"\n"; } avg=total/5.0; } void display() { cout<<" "<<rollNo<<" "<<Name<<" "<<age<<" "; cout<<total<<" "<<avg<<"\n"; }};

Page 22: Oop concept

int main()

{

Student s[10];

int n;

cout<<"enter no.of student: ";

cin>>n;

for(int i=0;i<n;i++)

{

cout<<"\nenter details of student: "<<i+1;

s[i].setdata();

}

cout<<"\n********************************* \n\n";

cout<<"\nRollno Name Age Totalmark AverageMark\n";

for(int i=0;i<n;i++)

{

s[i].display();

}}

Page 23: Oop concept

Thank you

Page 24: Oop concept

If this presentation helped you, please visit our page facebook.com/baabtra and like it.

Thanks in advance.

www.baabtra.com | www.massbaab.com |www.baabte.com

Page 25: Oop concept

Contact Us

Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550

NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550

Start up Village Eranakulam, Kerala, India.

Email: [email protected]

IKK Road, East Hill, Kozhikode Kerala, India. Ph: + 91 – 495 30 63 624

NIT-TBI, NIT Campus, Kozhikode, Kerala, India.

Page 26: Oop concept

In C++

Int main()

{

Private:

Protected:

Public:

}

Page 27: Oop concept

In java

Int main()

{

Default:

Private:

Protected:

Public:

}