Explanation by Analogy - What is wrapping?
Example 1: An Ipad "wraps" an Iphone
What does the ipad do that the iphone doesn't do?
Aren't they basically the same thing, except one has a bigger screen?
The Ipad "wraps" the iphone: meaning that you have all the benefits of the iphone WITHIN the ipad itself, AND have the benefits of a larger screen etc. But fundamentally, inside the ipad, lies an Iphone.
What then is different? The only thing that is different is the exterior: you have a larger screen, and perhaps, you cannot make phone calls on the Ipad.
It's literally the same thing with "objects".
.............the inside has all the good stuff which is the same, but a different exterior. A different wrapper.
"Wrappers may expose different features than the underlying object" ......okay, but what does this mean?
Sometimes the wrapper might limit the things you can access inside. For example, the ipad may limit your ability to make phone calls, even though the Iphone buried within it, has that capability.
Example 2: Automatic car acting as a wrapper to a manual car
Think of an automatic car, and a manual car. Behind the scenes, in an automatic car, there is some engineering mechanism which automatically changes the gears for you, but fundamentally, under the surface, the car is still a manual car. In other words, the automatic features of the car "wraps" the manual functionality of the car. If you wanted to manually change the gears by yourself in an automatic car - you simply can't do it. The ability to change gears "is not exposed" in the automatic car. But it is exposed in a manual car. Granted the analogy is a little strained, but I hope you see what I'm getting at.
But what is the purpose of a wrapper?
You'd write a wrapping class if you wanted to simplify things. You'd create an easy to use 'wrapper' and leave all the complicated bits inside the wrapper, ensuring that those complicated bits are not 'exposed'.
For example, you could have a .net wrapper, which underneath, makes COM calls. If you didn't have a wrapper, then you'd be forced to make those COM calls yourself. Luckily with the wrapper, you'd just make the calls to the .net wrapping code - which would in turn make those COM calls. And that should hopefully simplify things for you.
- Can you unscramble the word PPOCER
- Which country is the most brutal
- What are the people of Russia like?no_redirect=1
- Are older Bose speakers worth buying
- Is bitcoins legal
- What will be obsolete in 25 years
- Does IQ limit career opportunities
- Is a marriage required for baptism
- Who was your rival in high school
- What separates one galaxy from another
- What do carbon capture plants do
- Will mphasis be more suited for freshers
- Which websites pays you for clicks?no_redirect=1
- Does technology drive history
- Which colour do kids like the most
- How does 4k TV work
- How is grounding done in ships
- What should I research
- What are the solutions to humanitarian crisis