CPP Language / Object-Oriented Programming (OOPS)

Object-oriented programming (OOPS)uses objects in the programming languages. Object is a real world thing or entity. An object consists of State, Behavior and Identity.

Property Details Example
Identity It is the name of an object and enables one object to interact with other objects. Name of dog
State It is represented by attributes of an object. It also reflects the properties of an object. Breed, Age and color
Behavior It is represented by methods of an object. It also reflects the response of an object with other objects. Bark, sleep and eat

OOPs Concepts
OOPs Concepts Details Examples
Polymorphism Poly means many, morphism means forms. It means a functions take more than one form in terms of number of arguments and their data types sum(int x, int y)
sum(int x, float y)
sum(int x, float y, double z)
Inheritance One class is allowed to inherit the features (fields and methods) of another class. Parent -->child
Encapsulation Binding of code and data. Code + data.
Abstraction Outline Car is for travelling it dont reveal any details about car.
Class It is collection of methods and instance variables. Class a
{
Int x;
Public method a(){}
}
Object Object is a real world thing or entity
#include
using namespace std;
class a
{
public: string vn;
void fn()
{ cout << " vn is: " << vn; } };
int main() {a obj1;
obj1.vn = "abcd";
obj1.fn();
return 0;
}

Output
Vn is : abcd
Method It is a collection of statements that perform some specific task and return result to the caller. void fn()
{
cout << " vn is: " << Materials; }
};

Message Passing Objects communicate with each other by sending and receiving information. msg
Obj -------obj

Advantages of OOP
Reusability Inheritance
Modularity Break The Problem Into Part Called As Modularity.
Flexibility Polymorphism Feature
Maintainability It Is Easy To Add New Classes, Objects, Etc Without Much Restructuring /Changes.
Abstraction Data And Information Hiding

Applications of Object Oriented Programming
1. User interface design such as windows, menu.
2. Real Time Systems
3. Simulation and Modeling
4. Object oriented databases
5. AI and Expert System
6. Neural Networks and parallel programming
7. Decision support and office automation systems etc.


Home     Back