POV-Ray : Newsgroups : povray.off-topic : Quick C++ question... : Re: Quick C++ question... Server Time
4 Sep 2024 21:18:08 EDT (-0400)
  Re: Quick C++ question...  
From: Warp
Date: 11 Nov 2009 15:55:47
Message: <4afb24d2@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
>   (A very ugly solution would be to use void pointers, and then reinterpret
> cast them as needed. But if you are determined to not to have to #include
> that header, then that's something that would work.)

  I thought of another uglyish kludge that might work and, while kludgey,
not necessarily as ugly as the void pointers:

// Header:
class dfbScreen
{
    class MyIDirectFB
    MyIDirectFB* dfb;
...
};

// Source file:
class dfbScreen::MyIDirectFB: public IDirectFB
{
 /* If IDirectFB supports copying, you can just implement a constructor
    here which takes an instance of type IDirectFB in order to initialize
    objects of type MyIDirectFB, like:

    MyIDirectFB(const IDirectFB& init): IDIrectFB(init) {}

    If IDirectFB does not support copying, then you'll have to replicate
    its constructors here. No way of automatizing that until the next C++
    standard gets implemented in compilers.
  */
};

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.