What are wrapper(sp?) classes? I have heard the term used but do not know what it means.
Ehh maybe I should look in the FAQ.
What are wrapper(sp?) classes? I have heard the term used but do not know what it means.
Ehh maybe I should look in the FAQ.
They wrap around an API. So you can write a program using a wrapper class for sockets on linux. and you can write a same wrapper class for sockets for windows, and use your program without changing it.
it would have obvious functions like
write(...);
read(...);
open(...);
close(...);
which would in turn call the platform-specific api.
So to create a wrapper class you need to understand the API first.
I just queried the FAQ.
I started learning the Win32 API from Charles Petzold's book and thought how can I turn this from C into C++. I guess one needs to implement wrapper classes.
Are there any books that step through the process of creating wrapper classes especially for the Win32 API?
I am not looking for a lesson on MSFC though, rather on how to implement my own wrapper classes.
Most of the api calls are already wrapped in C++ classes, but if you really want to wrap everything, you might end up with a lot of grey hair ... in about 20 years or so - when you're finished.
[code]
your code here....
[/code]
A wrapper class does not neccessarily have to wrap around an entire API. for example this could be a simple (pointless, although needed in Java) wrapper class. This class is a wrapper for the primitive type 'int'
Code:class Integer { int i; public: Integer() { i = 0; } int intValue() { return i; } /* etc ... */ };
I merely pointed out that it could take a bit longer to wrap the entire windows API and that partial implementations already exist.Originally posted by Perspective
A wrapper class does not neccessarily have to wrap around an entire API.
[code]
your code here....
[/code]
Speaking of a berkley sockets wrapper, would any of you guys have one handy?