vendredi 14 juillet 2017

Overloading the Default Constructor of a Template Class

How do I implement the overloaded default constructor of a template class. How do you know what to initialize the classes member variables with if I do not know what the generic datatype is? For example, if I have a template class such as

template<class ItemType>
class someClass
{
     private:
       ItemType value;
     public:
       //overloaded default constructor
       someClass() { ItemType value = ??? }
};

Aucun commentaire:

Enregistrer un commentaire