vendredi 24 février 2017

Universal Class in C++

I was working on a project that includes a lot of custom data types I needed a base data type from which all of them are derived. So I tried this:

class base
{
    // code
}
class dType1: public base
{
    // code
}

Till now it worked fine. But as soon as there's something like this:

template <typename T>
class dType2: public base
{
    // code
}

I get errors here. I can understand the situation that class base has no template argument whereas, the class dType2 has got template argument(s).

My question is

Is there any way to make an ultimate base class so that any other class whether having template arguments or not can be derived from it?

Aucun commentaire:

Enregistrer un commentaire