Solved

Please define wrapper class

Posted on 2006-11-30
4
1,056 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
ID: 18046601
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 70

Expert Comment

by:Éric Moreau
ID: 18046613
0
 
LVL 22

Expert Comment

by:_TAD_
ID: 18049190
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
ID: 18051159
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

813 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

16 Experts available now in Live!

Get 1:1 Help Now