abstraction:It refers to the act of representing essential features without including the background details.
for example: if a customer wants to buy a car.he looks at its color perfomance etc but he doesnt look at things like how these are functioning internally etc.
encapsulation:the wrapping up of data and functions into a single unit called class is called encapsulation.
Abstraction:It refers to the act of representing essential features without including the background details.for example:If a customer wants to buy a car.he looks at its color perfomance etc but he doesnt look at things like how these are functioning internally etc.Encapsulation:The wrapping up of data and functions into a single unit called class is called encapsulation
RE: what is the difference betwwen in Abstractionand Encapsulation.explain with example
Abstraction is just like a Hotel room where a single person wants only 1bed+bathroom but family required minimum of double bed +bathroom. Whereas few people want AC system or hot water system or TV like accessories but other don t. During the designing of hotel all requirements will considered. So that hotel will produce more profit.In the same way when an object is fulfill a variety of requirement then an object having abstraction feature.Take an example of hotel only to understand what is encapsulation? How many staff entertaining all requirements of guests visited in a hotel? From where they purchased all bed desk Ac system TV etc? Beside of all such complexities we enjoy the hotel room during our journey. A hotel is not a construction of brick but it is having rooms with well furnished staff to entertain request. This is what encapsulation. When an object having many data members and methods to fulfill the different requirements then an object having encapsulation feature.