私はレイトレーシングタスクに取り組んでいます。問題のあるソースは次のとおりです。
class Geometry
{
    public:
        virtual RayTask *intersectionTest(const Ray &ray) = 0;
};
class Sphere : public Geometry
{
    public:
        RayTask *intersectionTest(const Ray &ray);
};
class BoundingVolume
{
    public:
        virtual bool intersectionTest(const Ray &ray) = 0;
};
class BoundingSphere : public Sphere, BoundingVolume
{
    public:
        bool intersectionTest(const Ray &ray) // I want this to be inherited from BoundingVolume
        {
            return Sphere::intersectionTest(ray) != NULL; // use method in Sphere
        }
};
上記のソースはコンパイルできません、エラー情報:
error: conflicting return type specified for ‘virtual bool BoundingSphere::intersectionTest(const Ray&)’
error:   overriding ‘virtual RayTask Sphere::intersectionTest(const Ray&)
Sphereのメソッドを使用してBoundingSphere::intersectionTestを実装したいので、BoundingVolumeとSphereの両方から継承する必要があります。しかし、リターンタイプが異なる同じパラメータリストを持つ関数を継承するため、物事が混乱しました...
同じ機能のコードを複製したくない...誰かが私に解決策を教えてもらえますか?...