Results 1 to 5 of 5

Thread: How to make a class of other people's functions?Source not provided!

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2001
    Posts
    396

    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.
    I'm a VB6 beginner.

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2001
    Posts
    396
    I had a strange feeling that I had just answered my own question.
    I'm a VB6 beginner.

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  4. #4
    Zaei
    Guest
    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.

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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
  •  



Click Here to Expand Forum to Full Width