D
Dan Smithers
Is it possible to realise an abstract base class with a template? The
reason that I'm considering this is that I would like to present a fixed
interface that I realise using a completely independent implementation
module and avoid including the template code in the client code.
I want something like this:
interface.
ILog
{
public:
virtual void method() = 0;
virtual ~ILog;
static ILog& create();
protected:
ILog();
};
realisation:
template <typename T>
class CLog:ILog
{
public:
virtual void method();
virtual ~CLog;
static CLog& create();
protected:
CLog();
}
Am I actually trying to make this more complicated than it needs to be?
reason that I'm considering this is that I would like to present a fixed
interface that I realise using a completely independent implementation
module and avoid including the template code in the client code.
I want something like this:
interface.
ILog
{
public:
virtual void method() = 0;
virtual ~ILog;
static ILog& create();
protected:
ILog();
};
realisation:
template <typename T>
class CLog:ILog
{
public:
virtual void method();
virtual ~CLog;
static CLog& create();
protected:
CLog();
}
Am I actually trying to make this more complicated than it needs to be?