Object Oriented Programming With C++
Principles and advantages of oop
CONCEPTS OF OOP
Class object Inheritance Abstraction Encapsulation Polymorphism
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
OBJ E C T
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 objects
O B J E C T : emp D AT A : Emp_no Name Age Salary FUNCTIONS : Getdata (input) Total (find total salary) Display (output)
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
Multi level inheritance
EN C APSUL A TION
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 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.