OOPS, Concepts:
---------------------
1. Data hiding
2. Data abstraction
3. Polymorphism
3.1. Overloading
3.2. Overriding
4. Encapsulation
4.1 Tightly Encapsulation
5. IS-A Relationship
6. HAS-A Relationship (Composition/ aggregation)
7. Coupling
8. Cohesion
1. Data hiding:
Our internal data should no go out directly
after validation only, If the user is valid/ authorized then only they can access the data is a mechanism called data hiding
data hiding means we are providing some security to the data
In java how we can implement data hiding?
By using a concept called private modifier
2. data abstraction:
By hiding internal implementations, just highlight a set of business methods/ services called data abstraction.
realtime example:
ATM
a lot of services --->
case1: we are seeing only services(highlight)
case2: we don't see business implementations(hiding)
Any application only services are showing
We can implement data abstraction using abstracts and interfaces.
4. Encapsulation:
Encapsulation is the process of wrapping the data into a container
Ex: Water bottle is a container we are wrapping water
In java where we are going to wrap our data inside a container is called class
Every java class is the best example of encapsulation
Tightly encapsulation:
A class is said to be a tightly encapsulation class if and only if all the variables in that class should be of type private and it doesn't care about methods.
the methods can be anything
No comments:
Post a Comment