#include "memorycell /*construct the memorycell with initialvalue *template memorycell::memorycellconst object initialvalue storedvalueinitialvalue /*return the stored value *template const object memorycell::readconst return storedvalue/*store *template void memorycell::writeconst object storedvalue xfigure memorycell class template implementation be done for classes thusboth figure and figure would be exactly as currently shown the header file would not have an include directive to read the implementation the main routine would only have an include directive for the header file figure shows typical test program if we compile both cpp fileswe find that the instantiated member functions are not found we fix the problem by creating separate file that contains explicit instantiations of the memorycell for the types we use an example of the explicit instantiations is shown in figure this file is compiled as part of the projectand the template implementation file (figure is not compiled as part of the project we have had success using this technique with several older compilers the downside is that all of the template expansions have to be listed by the programmerand when the class template uses other class templatessometimes those have to be listedtoo the advantage is that if the implementation of the member functions in memorycell changesonly memorycellexpand cpp needs to be recompiled