I got a chance to learn design concepts which was conducted by our company VP, the below words whatever I am saying is said by him,
This gives the clear picture of Oops concept
Oops Concept with Hotel
Abstraction :
Has a customer, if you visit a hotel, you will see cashier , supplier , table
Has a owner, if you visit the same hotel, you will see cash collected, food supplied , no. of tables provided..
The abstraction level for the same object ( Hotel) is different for customer and Owner
This is called Abstraction
Encapsulation
Encapsulation is how much you cover to set the abstraction level.
Ex: If you visit a hotel, if the cooking place is visible to you than the abstraction level as a customer is more exposed.
So, Abstraction is "what you see" and Encapsulation is "what you show"
Polymorphism :
If you visit a hotel, you give a cash to cashier, Cashier work is only to collect cash, assume there are less no. of workers than cashier may also supply food to you and clean the table
This is called Polymorphism
No comments:
Post a Comment