ch01 Object oriented Concepts

Category: Education

Presentation Description

No description available.


Presentation Transcript

Chapter 1 - INTRODUCTION : 

1 Chapter 1 - INTRODUCTION Object Oriented Concepts

Chapter 1 - Objective : 

2 Chapter 1 - Objective Object-oriented concepts.

Object-Oriented Concepts : 

3 Object-Oriented Concepts Abstraction, encapsulation, information hiding. Objects and attributes. Methods and messages. Classes, subclasses, superclasses, and inheritance. Overloading. Polymorphism and dynamic binding.

Abstraction : 

4 Abstraction Process of identifying essential aspects of an entity and ignoring unimportant properties. Concentrate on what an object is and what it does, before deciding how to implement it.

Encapsulation and Information Hiding : 

5 Encapsulation and Information Hiding Encapsulation Object contains both data structure and set of operations used to manipulate it. Information Hiding Separate external aspects of an object from its internal details, which are hidden from outside. Allows internal details of an object to be changed without affecting applications that use it, provided external details remain same. Provides data independence.

Object : 

6 Object Uniquely identifiable entity that contains both the attributes that describe the state of a real-world object and the actions associated with it.

Methods and Messages : 

7 Methods and Messages Method Defines behavior of an object, as a set of encapsulated functions. Message Request from one object to another asking second object to execute one of its methods.

Object Showing Attributes and Methods : 

8 Object Showing Attributes and Methods

Example of a Method : 

9 Example of a Method

Class : 

10 Class Blueprint for defining a set of similar objects. Objects in a class are called instances. Class is also an object with own class attributes and class methods.

Subclasses, Superclasses, and Inheritance : 

11 Subclasses, Superclasses, and Inheritance Inheritance allows one class of objects to be defined as a special case of a more general case. Special cases are subclasses and more general cases are superclasses. Process of forming a superclass is generalization; forming a subclass is specialization. Subclass inherits all properties of its superclass and can define its own unique properties. Subclass can redefine inherited methods.

Subclasses, Superclasses, and Inheritance : 

12 Subclasses, Superclasses, and Inheritance All instances of subclass are also instances of superclass.

Single Inheritance : 

13 Single Inheritance

Multiple Inheritance : 

14 Multiple Inheritance

Overriding, Overloading, and Polymorphism : 

15 Overriding, Overloading, and Polymorphism Overriding Process of redefining a property within a subclass. Overloading Allows name of a method to be reused with a class or across classes. Polymorphism Means ‘many forms’. Three types: operation, inclusion, and parametric.

Example of Overriding : 

16 Example of Overriding Might define method in Staff class to increment salary based on commission: method void giveCommission(float branchProfit) { salary = salary + 0.02 * branchProfit; } May wish to perform different calculation for commission in Manager subclass: method void giveCommission(float branchProfit) { salary = salary + 0.05 * branchProfit; }

Overloading Print Method : 

17 Overloading Print Method

Dynamic Binding : 

18 Dynamic Binding Runtime process of selecting appropriate method based on an object’s type.

authorStream Live Help