Thread: Definition
View Single Post
  #3 (permalink)  
Old October 10th, 2005, 04:40 PM
Jeff Mason Jeff Mason is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: Hudson, MA, USA.
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
quote:Originally posted by Little Shell
WHAT IS A WRAPPER?
A wrapper class is a class which typically contains another class, thus "wrapping" the functionality of one class inside another. This is also called the "facade" design pattern.

It is used to perhaps hide some of the functionality of the contained class. The containing, or wrapper, class exposes only the functionality of the contained class that it needs to.

Sometimes, a wrapper is provided to simplify the interface to the contained class. For example, a class that sends an email might have properties and methods to separately set the sender, receiver, subject, and message body, and then send the message. To make interacting with this class easier, I might devise a wrapper class around an email object that exposes a single send method taking these values as parameters and "behind the scenes" creates the email class, sets all the properties as appropriate and sends the message. Thus, my class is much easier to use than the original email class, since I expose only a single method and I don't have to bother the user of the class with all the messy details of setting up and sending the email.

The entire .NET framework can be considered a wrapper around the WIN32 API...

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com
Reply With Quote