Originally the base class B was derived from class A. But as C derives from both A and B I got into a nasty diamond shaped inheritance and thus removed the inheritance in B opting for a conversion function to A.
Now I'm getting warnings for classes of typ C, due to conversion to base classes never being used. How can I fix or remove those? The program runs without issues.
// base class providing most functionality
class A{
public:
int doStuff(){ return 0; };
};
// pure virtual interface providing a conversion to A
class B{
public:
virtual operator A&()=0;
};
// interface implementation
class C: public A, public B{
public:
virtual operator A&() override{return *this;}
};
warning: conversion function converting 'C' to its base class 'A' will never be used
virtual operator A&() override{return *this;}
^