编译C++文件,特别是多文件的时候,经常要找模板,这里为了后面方便,就自己做了一个模板. makefile模板:Makefile # Object files to either reference or create #OBJECTS = Proj2.o Blackjack.o Deck.o Card.o Hand.o Player.o OBJECTS = phash.o # The executable file that will be created at the end EXEC =…
C++在发展的后期增加了模板(template )的功能,提供了解决这类问题的途径.可以声明一个通用的类模板,它可以有一个或多个虚拟的类型参数. 比如: class Compare_int class Compare_float 都是比较大小的函数,只是参数类型不同,于是用一个类模版综合成一个函数: template <class numtype> //声明一个模板,虚拟类型名为numtype class Compare //类模板名为Compare { public : Compare(nu…