principles and advantages of oop ppt
TRANSCRIPT
Object Oriented Programming With C++
Principles and advantages of oop
CONCEPTS OF OOP
• Class
• object
• Inheritance
• Abstraction
• Encapsulation
• Polymorphism
CLASS
• A class is a collection of objects of similar type.• Example:- mango, apple and orange are members of the
class fruit.• Classes are user-defined data type and built-in
type of a programming language. • fruit mango: will create an object mango belonging to the
class fruit
OBJECT
• Object are the basic run time entity in an object –oriented system.
• They may represent a person, a place, a bank account, a table of data or any item that program has handle.
Example of objectsOBJECT : emp
DATA : Emp_noNameAgeSalary
FUNCTIONS : Getdata (input)Total (find total salary)Display (output)
INHERITANCE
It is the capability of one class to inherit properties from another class.
5 types of inheritance Single level Multilevel Multiple Hierarchical Hybrid
Single level inheritance
Base classFlower
Rose Derived class
Single level
Multi level inheritance
Base class
Rajasthan
Jaipur
World
India
Multi level
Multiple inheritance
Bird
Parrot Sparrow
Multiple inheritance
Base class
Derived class
ABSTRACTION
Definition- The act of representing essential features without including the background details or explanations.
• Classes uses the concept of abstraction and are defined list of abstract attributes.
• The attributes are sometime called as data members because they hold information.
• The function that operates on these data are sometimes called methods or member function.
ENCAPSULATION
• Definition :- The wrapping up of data and functions into a single unit.
• Data encapsulation is the most striking feature of class.
• Encapsulation means that some or all of an object's internal structure is "hidden" from the outside world.
POLYMORPHISM
•polymorphism is the ability of objects of different types to respond to functions of the same name.
Types of polymorphism
• Virtual functions.• Operator overloading.• Function overloading.
ADVANTAGES OF OOP
• Through inheritance, we can eliminate code and extend the use of existing classes.
• Reusability.• Easy to understand.• Models the real world well.• The principle of data hiding helps the programmer to
build secure programs.• Software complexity can be easily managed.
• It is essay to partition the work in a project based on object.
• Software complexity can be easily managed.• Object –oriented system can be easily upgraded from
small to large system.