Results 1 to 4 of 4

Thread: inheritance in dll

  1. #1

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500

    Unhappy inheritance in dll

    i have to classes, WINDOW and BUTTON. they are both to be exported from the dll. also, both of these classes inherit from a class called WNDSKELETON.
    when i compiled it gave me an error like this

    Code:
    warning C4275: non dll-interface class 'WNDSKELETON' used as base for dll-interface class 'CHILD'
    i went on the msdn to look up the warning, and from what i understand, i have to export the WNDSKELETON class as well in order to avoid this warning. if i dont do it also get this error in my client:

    Code:
    struct HWND__ * __thiscall WNDSKELETON::GetHwnd(void)" (?GetHwnd@WNDSKELETON@@QAEPAUHWND__@@XZ)
    when i use the function through one of the classes (WINDOW or BUTTON).
    what if i dont want the user to be able to use WNDSKELETON directly?
    should i just not use inheritance?
    thanks in advance!

    Amon Ra
    Amon Ra
    The Power of Learning.

  2. #2

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500
    ok i uploaded the project with all the classes to be exported..thanks to anybody who helps me..also i found out that for some reason, nothing happens when i try to create my window..
    thanks again
    Attached Files Attached Files
    Amon Ra
    The Power of Learning.

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Make all constructors of the base class protected. This will make it impossible to directly create an object of the base class because the constructor cannot be accessed. The derived classes still can call the constructor, so you can create objects of this classes.
    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

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500
    ok, thanks
    Amon Ra
    The Power of Learning.

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