Computer Science, asked by pratyush4427, 7 months ago

IMPORTANT Principles of OOP's
with there defination and Example in real life as well as In Java.
4427 answer this please.......​

Answers

Answered by Anonymous
0

Life itself is a very suitable example of java as it also follows the same OOP principles followed by java. Object each of our body parts have their state 

Answered by 4427
5

Important Principles of OOP are As Follows-:

(1) Data Abstraction

(2) Encapsulation

(3) Inheritance

(4) Polymorphism

Real Life examples-:

(1) Data Abstraction-* In java Abstraction is the concept of simplifying a real world concept into its essential elements .

* In real life For example When we are driving a car we only know the essential features to drive a car e.g. gear handling, steering handling, use of clutch, accelerator, brakes etc we just change the gears or apply brakes etc. But what is happening inside is hidden from us . This is Abstraction where you only know the essential things to drive a car without including the background details or explanations.

(2) Encapsulation-* In java the wrapping up of data and operations/functions(that operate on the data) into a single unit (called class) is known as encapsulation.

*In real life in a company there are so many departments, sales, accounts, payroll, purchase, production etc. Each department has its own personal that maintains its data. Suppose an employee in the production department wants to know how much raw material has been purchased for the next month. The production dept employee would not be allowed to himself go through the purchase department's data files. Rather he'll have to issue a memo to the purchase requesting for the required information.

Then some employee of the purchase department will go through the purchase data files and send the reply with the asked information. This practice ensures that the data is access accurately and that it is not corrupted by inept outsiders. Therefore, we can say here 'Department data and department employees are encapsulated into a single entity, the department'.

(3) Inheritance-* In java Inheritance is the capability of one class of things to inherit capabilities or properties from another class.

* In real life for example The class 'Car' inherits some of its properties from the class 'Automobiles' which inherits some of its properties from another class 'vehicles'. The capability to pass down properties is a powerful one. It allows us to describe things in a economical way.

(4) Polymorphism-* In java Polymorphism is the ability for a message or data to be processed in more than one form.

* In real life For example 'Human' is a subclass of 'Mammals' similarly, 'Dog', 'Cat' are also subclasses of 'Mammal'. Mammal can see through daylight. So if message 'see through day light' is passed to all mammals they all will behave alike. Now if a message 'see through darkness' is passed to all mammals, than humans and dogs will not be able to view at night, whereas cats will be able to view during night also here cats (mammals) can behave differently than other mammals in response to a message or action. This is polymorphism.

HOPE IT HELP'S YOU

PLEASE MARK MY ANSWER AS BRAINLIST

RADHE RADHE ♥️✌️

Similar questions