25

OOPS Characteristics

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: OOPS Characteristics
Page 2: OOPS Characteristics

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

Page 3: OOPS Characteristics

Characteristics of OOPS

Name@[email protected]

mwww.facebook.com/ Abhishek H

menon twitter.com/Abhishek H Menonin.linkedin.com/in/Abhishek H

menonPhonenumber:9496519895

Page 4: OOPS Characteristics

Object oriented programming

• is a programming paradigm that represents concepts as “objects” that have data fields and associated procedures known as methods.

• data fields :attributes that describe objects.• methods : some procedures designed for a

specific task.

Page 5: OOPS Characteristics

Object

• which are usually instances of classes, are used to interact with one another to design

applications and computer programs.• An object is an instantiation of class. In terms

of variables, a class would be a type, and an object would be a variable.

Page 6: OOPS Characteristics

Class

• A class is an expanded concept of a data structure: instead of holding only data, it can hold both data and functions.

e.g. class class_name{access_specifier_1:member_1;access_specifier_2:member_2;………………..

}

Page 7: OOPS Characteristics

Members of Class

• Private: private members are accessible only in the class itself.

• Public: public members are accessible outside the class(anywhere).

• Protected :protected members are accessible in the same package, and in the subclasses of the class and inside the class.

Page 8: OOPS Characteristics

Characteristics of OOPS

• Data Encapsulation• Inheritance• Polymorphism• Data Abstraction

Page 9: OOPS Characteristics

Encapsulation

• It is the mechanism that binds the data & function in one form known as class. The data and function may be private or public.

• Encapsulation guarantees the integrity of the data contained in the object.

Page 10: OOPS Characteristics

Object binds together in the form of a class..

Animal

Dog Fish

MuttBull StarGold

Cat

Page 11: OOPS Characteristics

Inheritance

• Mechanism of deriving a new class from an already existing class.

• 5 levels of inheritance-Single level-Multilevel-Multiple

-Hierarchical-Hybrid

Page 12: OOPS Characteristics

Types of Inheritance

Base Class

Derived Class

Single level

Multi Level

Flower

Rose India

World

Rajastan

Jaipur

Page 13: OOPS Characteristics

Types of Inheritance

Bird

PigeonParrot

Multiple

Base Class

Derived

Page 14: OOPS Characteristics

Types of Inheritance

• Single levelClass Base{

Data members and Functions;};Class Derived : Public Base{Data members and Functions;};

• Multiple Class A{};Class B{};Class C:Public A , Public B{};

Page 15: OOPS Characteristics

Types of Inheritance

• Multi LevelClass A{};Class B: Public A{};Class C :Public B{};Class D: Public C{};

Page 16: OOPS Characteristics

Hierarchical Inheritance

B DC

A

G HFE

Page 17: OOPS Characteristics

Hybrid Inheritance

• Combination of the above types of inheritances.

e.g. Hierarchical + MultipleMulti level + Multiple etc.

Page 18: OOPS Characteristics

Polymorphism

• Poly means many. Morphism means forms.• Polymorphism feature enables classes to

provide different implementation of methods having the same name.

• Two types of Polymorphism – Compile time (Overloading)– Run time(Overriding)

Page 19: OOPS Characteristics

Overloading

• Overloading– In method overloading, a method is executed

depending on the number and type of parameters passed to it.

– When we compile the class, the compiler binds the appropriate method to the object based on the method’s arguments. This is called early binding and this process is referred to as compile time polymorphism

Page 20: OOPS Characteristics

Overriding

• You can have a method in subclass overrides the method in its super classes with the same name and signature. Java virtual machine determines the proper method to call at the runtime, not at the compile time.

Page 21: OOPS Characteristics

Abstraction

• Abstraction is simplifying complex reality by modelling classes appropriate to the problem, and working at the most appropriate level of inheritance for a given aspect of the problem.

• It deals with the outside view of the object.

Page 22: OOPS Characteristics

Abstraction

• Modifiers:If you want to access a particular variable , method or class from anywhere , then make that variable accessible by using public modifier.

If you want to restrict a particular variable , method or class to be accessible outside the class , use private modifier.

Page 23: OOPS Characteristics

Abstraction v/s Encapsulation• class person

{private String name;public void main(){System.out.println(""+name);

}}

• Abstraction means giving useful information , Encapsulation means hiding unnecessary information.

Page 24: OOPS Characteristics

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: OOPS Characteristics

Contact Us