Prototyping a template function in C++ -
i learning templates in c++, , problem on homework asks me following:
//use template below answer questions , create c++ functions: template<class t> void enemyadjust(t objparm) { objparm.moveposition(); objparm.fireweapon(); } //write 1 line of code prototype template function using type: rapiddog
what mean? i've tried typing void enemyadjust(rapiddog)
, variations, others, none of them seem right. asking for? understand basics of template functions, , can write one, don't understand question or i'm supposed do.
note: it's online homework; tells whether got right or wrong , asks try again continue.
usually prototype function's signature (its declaration). here, however, asked instantiate explicitly.you can typing:
template void enemyadjust<rapiddog>(rapiddog objparm); // explicit instantiation
Comments
Post a Comment