I want to have a general storage class that can store variety of objects, I don't want to use a heterogeneous container class that stores all of them. I thought of creating a templated storage class, and create a general storage class that inherits from this metaclasses with different types:
template<typename Type>
struct SingleInterface
{
public:
SingleInterface() = default;
virtual ~SingleInterface() = default;
SingleInterface(const SingleInterface &) = default;
SingleInterface & operator=(const SingleInterface &) = default;
SingleInterface(SingleInterface &&) = default;
SingleInterface & operator=(SingleInterface &&) = default;
void get(const std::string & keyword, Type * ptr)
{
// implementation
}
};
My general class as below:
class MutliInterface: public SingleInterface<double>, SingleInterface<int>
{
public:
MutliInterface() = default;
virtual ~MutliInterface() = default;
};
when I create a MutliInterface class, I get the following error:
MutliInterface interface;
double *v;
interface.get("test", v);
'get' is ambiguous '