<分区>
Possible Duplicate:
Why can templates only be implemented in the header file?
Why should the implementation and the declaration of a template class be in the same header file?
我将创建几个 ADT 并比较它们的性能(我正在学习数据结构类(class)并想进行实验;注意:我们的讲师使用 Java)。我想创建通用类,这样我就不会受制于特定的数据类型。我很久以前读到过,不可能拆分模板类。保持代码清洁的最佳方法是什么?最明显的方法是简单地使用 .cpp 文件而不隐藏实现,例如在 java 中。我可以使用其他方法吗?