|
-
Dec 15th, 2001, 07:05 AM
#1
Thread Starter
Hyperactive Member
How to make a class of other people's functions?Source not provided!
Well guys, can I make other functions as my class's member functions? Source code not available to me. Can I do this in order to make a OOP framework out of the APIs.
Izzit as easy as declaring the member functions as extern and include the header?
Or it is not possible?
If it is not possible, I have to make a wrapper class in which its member functions call the APIs.
Any ideas or comments, pls contribute them here....
Thanks.
-
Dec 15th, 2001, 07:07 AM
#2
Thread Starter
Hyperactive Member
I had a strange feeling that I had just answered my own question.
-
Dec 15th, 2001, 08:25 AM
#3
You did 
This is a big part of what the MFC does: call API functions from within it's member functions. It is not possible to use the API functions as member functions directly.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 15th, 2001, 04:24 PM
#4
Although you CAN fake it:
Code:
typedef DWORD TFunc();
class myAPIClass
{
public:
myAPIClass();
TFunc* getTickCount;
};
myAPIClass::myAPIClass()
{
getTickCount = GetTickCount;
}
...
myAPIClass x;
DWORD t;
t = x.getTickCount();
Z.
-
Dec 19th, 2001, 12:38 PM
#5
Messy: the compiler can't do any type checking at all! Inline wrapper functions are a lot cleaner and the same speed.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
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
|
Click Here to Expand Forum to Full Width
|