Wrapper

Sharky Forums


Results 1 to 6 of 6

Thread: Wrapper

  1. #1
    Tiger Shark NC's Avatar
    Join Date
    Jan 2007
    Posts
    625

    Question Wrapper

    What is a wrapper in computer programming?
    Dell 8300, XP Home, GeForce FX5200, HR MicroDAC audio and Swans M200 MKII
    IBM T60 Thinkpad

  2. #2
    Really Cold Shark eshbach's Avatar
    Join Date
    May 2003
    Location
    San Luis Obispo, CA
    Posts
    5,740
    Quote 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.

  3. #3
    Tiger Shark NC's Avatar
    Join Date
    Jan 2007
    Posts
    625
    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

  4. #4
    Hammerhead Shark
    Join Date
    Jun 2003
    Posts
    1,019
    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

  5. #5
    Catfish skoechle's Avatar
    Join Date
    Jan 2004
    Location
    Arizona
    Posts
    182
    Quote 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...
    CPU: AMD 64 X2 4400+ Toledo Core
    Mem: 2048 DDR PC3200
    Video: BFG 7900GS
    HD: 80GB Raptor
    HD2&3: 400GB WD Sata

    Sharky's Extreme 3DMark Team

    3dMark03 Score = 19673
    3dMark05 Score = 9327
    3dMark06 Score = 5149
    Sharky Forums Folding Team
    Want to Learn about folding? Watch this!

  6. #6
    Hammerhead Shark
    Join Date
    Feb 2001
    Posts
    1,612
    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
  •