Archived

This topic is now archived and is closed to further replies.

Wrapper?

This topic is 5143 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Can someone explain to me what a wrapper is! And also im a little confused with the New Microsoft .NET compiler, am i able to code my normal windows aplications just like a do now in it with the same code, in Visual C++ 6.

Share this post


Link to post
Share on other sites
A wrapper is something that wraps around another thing

It usually means that you make your own class hierarchy and interface, that wraps around something that you already have. It could be a c library that you want to turn into an object oriented class library for example. Wrappars also usually makes things easier, initializes values with some defaults, that suit your needs, makes complex operations easy to do, by assuming, you will always do it like that, and so on.

And you don''t need to do object oriented programming, to write and use wrappers. It can be done with standard procedural programming too.

And yes, you will be able to code exactly like you do now, when switching to Visual studio .net. If you decide to not use the new .net framework, or c# or something else that''s new.

Share this post


Link to post
Share on other sites
quote:
Original post by Mat1515
Can someone explain to me what a wrapper is!

And also im a little confused with the New Microsoft .NET compiler, am i able to code my normal windows aplications just like a do now in it with the same code, in Visual C++ 6.


// original
void HUNGARIANFUNCTIONNAME(void);

// wrapper
void a_readable_function_name(void)
{
HUNGARIANFUNCTIONAME();
}

Share this post


Link to post
Share on other sites
This isn't my post but thanks blizard999, I've been wondering what a wrapper was myself for a while and that is the best explanation i've seen
Now i think i get what csgl is

One little question if you dont mind, do wrappers around code slow the program down at all?


[edited by - Elite19 on November 12, 2003 12:54:15 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by Elite19
One little question if you dont mind, do wrappers around code slow the program down at all?

Maybe. In blizzard999''s (naive) example, the wrapper function could obviously be inlined, which would make a call to the wrapper function perfectly equivalent to a call to the wrapped function. However, wrapper classes may do more than this; one good example is detaching interface from implementation: You might, for instance, have a generic graphics API wrapper that encapsulates all the functionality of Direct3D and OpenGL so that you can run the appropriate system depending on what platform you are compiling and running your program on. In this case, since there is no longer a one-to-one correspondence, you might take a speed hit. (With a good design, however, it should be fairly slight - and with a good design it is presumably worth it.)

Share this post


Link to post
Share on other sites
quote:
Original post by Elite19
One little question if you dont mind, do wrappers around code slow the program down at all?


Well, a wrapper is an extra layer of indirection in that two functions are called instead of one (the wrapper function and the original function), so there is an overhead involved in setting up the stack frames for the calls. However, in practice this is unlikely to be noticable.



[edited by - Captain Logic on November 13, 2003 8:26:38 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
It''s the same with MFC that doesn''t require you to be able to code your own window stuff. Some programmers under Windows were really helped by this to learn how to use both the object paradigm and Windows itself. That''s quite good when you''re a beginner for you can choose to go deeper in the code only when you feel game for it.

Share this post


Link to post
Share on other sites