Solved

Please define wrapper class

Posted on 2006-11-30
4
1,055 Views
Last Modified: 2008-02-01
I hear the term "wrapper class" used all the time but have never seen an actual defintion of it.

What does it mean? Is there a formal definition?

I guessed it could mean  a class that contains or inherits another class and perhaps exposes some of the included or inherited class methods and properties.

0
Comment
Question by:cschene
4 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 125 total points
Comment Utility
That's pretty much it...

I've also seen in other languages where a control must be housed by something else to make it work, and then you need to "echo" all the inherent events to outside subscribers using custom events.

Sometimes a "wrapper class" is used to make things easier:
http://en.wikipedia.org/wiki/Fa%C3%A7ade_pattern

In Java, the primitives are wrapped to allow them to be treated as objects:
http://en.wikipedia.org/wiki/Wrapper_class
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
0
 
LVL 22

Expert Comment

by:_TAD_
Comment Utility
I see it most often used for commonly used API calls.

Suppose you really like the Win API Bit Block Transfer (BitBlT) that everyone used back in the VB6 days.

Calling DllImport and marshalByRef and al lthat other crap gets to be a pain to do a simple BitBlt over and over.

So you create a class that does all of the Marshaling and dllimport and then you simple call the .net class
0
 
LVL 7

Expert Comment

by:mjmarlow
Comment Utility
Not for the points, as the others have covered this well enough but here is my two cents

Wrapper class is a class that simplifies functionality by providing any of or combination of the following:
1.   Expose methods with fewer input parameters than would otherwise be needed.
2.   Aggregates method calls into a single method call.
3.   Redefines method, or property names for the sake of clarity or obscurity.
4.   Aggregates two or more classes to create a multiple inheritance effect.


0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now