Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1065
  • Last Modified:

Please define wrapper class

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
Christopher Schene
Asked:
Christopher Schene
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
0
 
_TAD_Commented:
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
 
mjmarlowCommented:
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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now