Suppose we have a class named DTOBase which contains some declarations, some times i need DTOBase with extra declarations based on given template like this :
class DTOBase {
/* DTOBase Declarations */
}
template<typename EntityType>
class DTOBase {
/* DTO Base Declarations */
/* Extra declarations for EntityType */
}
Now using classes:
DTOBase dto;
/* using with DTOBase members */
DTOBase<SomeEntity> dto;
/* using with DTOBase members and extra templated members */
I create a private base class and then created two version of DTOBase (non templated and templated one), but i think its possible to do it better way, eg. using C++11 template specialization or something like this.
Is it possible to declare a templated class, which inherits members from its non templated version?
Aucun commentaire:
Enregistrer un commentaire