|
-
Tiger Shark
Wrapper
What is a wrapper in computer programming?
Dell 8300, XP Home, GeForce FX5200, HR MicroDAC audio and Swans M200 MKII
IBM T60 Thinkpad
-
Really Cold Shark
 Originally Posted by NC
What is a wrapper in computer programming?
There are probably a couple valid definitions, but the first one that comes to mind is the concept of an object that contains functions for a specific primitive type.
In java, for instance, there is a class called Integer which is a "wrapper" for the primitive type int. Since java primitives aren't objects, they can't contain other primitives, objects, or methods. Some functions, such as parsing and conversion, are essential to effective object-oriented programming, and so the wrapper class provides that functionality for the primitive.
-
Tiger Shark
Can a a primitive be a basic function like a goto or an if /then statement?
Dell 8300, XP Home, GeForce FX5200, HR MicroDAC audio and Swans M200 MKII
IBM T60 Thinkpad
-
i think primitives are basic data types so i dont think it can be a function
but a wrapper can be used on functions and classes, from my classes it was defined as a class that encapsulates another class to give it a new interface
-
Catfish
 Originally Posted by eon
i think primitives are basic data types so i dont think it can be a function
Exactly a primitive is a data type like int, char, double, boolean, float...
-
A wrapper is anything that wraps around something else. If you want to define wrapper as something that defines a new interface for a primitive, then 'goto' or 'if/then' would count as a primitive. If you write a function to do an if/then statement, then you've written a wrapper:
Code:
Function IfThen (Function if_code, Function then_code)
If if_code() Then
then_code()
End If
Maybe wrapper is most often associated with object oriented programming, and then yeah it would be an object that wraps another object. Otherwise, the key point is just that it defines a new interface for something.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|