| 5 | 1/1 | 返回列表 |
| 查看: 761 | 回復: 4 | ||
[求助]
為何編不過?哪里錯了?
|
|
#include template template class CSampleTemplate { private: T t1; T2 t2; public: CSampleTemplace(T arg1, T2 arg2) { t1=arg1+num; t2=arg2+num; } void Write() { std::cout<<"t1:"< ~ CSampleTemmplate(void){} }; int main(int argc, char* argv[]) { CSampleTemplate temp.Write(); return 0; } 編輯錯誤為:ug-------------------- Compiling... 11.cpp E:\1\11.cpp(2) : error C2991: redefinition of template parameter '__formal' E:\1\11.cpp(2) : see declaration of '__formal' E:\1\11.cpp(2) : error C2059: syntax error : 'constant' E:\1\11.cpp(2) : error C2501: 'demol' : missing storage-class or type specifiers E:\1\11.cpp(14) : warning C4183: 'CSampleTemplace': member function definition looks like a ctor, but name does not match enclosing class E:\1\11.cpp(20) : see reference to class template instantiation 'CSampleTemplate E:\1\11.cpp(19) : error C2523: 'CSampleTemplate E:\1\11.cpp(20) : see reference to class template instantiation 'CSampleTemplate E:\1\11.cpp(11) : warning C4183: 'CSampleTemplace': member function definition looks like a ctor, but name does not match enclosing class E:\1\11.cpp(23) : see reference to class template instantiation 'CSampleTemplate E:\1\11.cpp(19) : error C2523: 'CSampleTemplate E:\1\11.cpp(23) : see reference to class template instantiation 'CSampleTemplate E:\1\11.cpp(23) : error C2661: 'CSampleTemplate Error executing cl.exe. 11.obj - 6 error(s), 2 warning(s) |
金蟲 (小有名氣)

金蟲 (小有名氣)

|
| 5 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 280求調(diào)劑 +11 | 咕嚕曉曉 2026-03-18 | 12/600 |
|
|---|---|---|---|---|
|
[考研] 材料學碩301分求調(diào)劑 +7 | Liyouyumairs 2026-03-21 | 7/350 |
|
|
[考研] 0703化學調(diào)劑 +4 | 妮妮ninicgb 2026-03-21 | 4/200 |
|
|
[考研] 313求調(diào)劑 +4 | 肆叁貳壹22 2026-03-19 | 4/200 |
|
|
[考研] 296求調(diào)劑 +4 | www_q 2026-03-20 | 4/200 |
|
|
[考研] 266求調(diào)劑 +3 | 哇呼哼呼哼 2026-03-20 | 3/150 |
|
|
[考研] 求調(diào)劑 +3 | .m.. 2026-03-21 | 4/200 |
|
|
[考研] 279求調(diào)劑 +5 | 紅衣隱官 2026-03-21 | 5/250 |
|
|
[考研] 265求調(diào)劑 +3 | Jack?k?y 2026-03-17 | 3/150 |
|
|
[考研] 307求調(diào)劑 +10 | 冷笙123 2026-03-17 | 10/500 |
|
|
[考研] 296求調(diào)劑 +6 | www_q 2026-03-18 | 10/500 |
|
|
[考研] 材料專碩英一數(shù)二306 +7 | z1z2z3879 2026-03-18 | 7/350 |
|
|
[考研] 一志愿南京理工大學085701資源與環(huán)境302分求調(diào)劑 +4 | 葵梓衛(wèi)隊 2026-03-18 | 6/300 |
|
|
[考研] 考研調(diào)劑求學校推薦 +3 | 伯樂29 2026-03-18 | 5/250 |
|
|
[考研] 中南大學化學學碩337求調(diào)劑 +3 | niko- 2026-03-19 | 6/300 |
|
|
[考研] 求調(diào)劑 +3 | 暗涌afhb 2026-03-16 | 3/150 |
|
|
[論文投稿]
申請回稿延期一個月,編輯同意了。但系統(tǒng)上的時間沒變,給編輯又寫郵件了,沒回復
10+3
|
wangf9518 2026-03-17 | 4/200 |
|
|
[考研] 一志愿985,本科211,0817化學工程與技術(shù)319求調(diào)劑 +10 | Liwangman 2026-03-15 | 10/500 |
|
|
[考研] 293求調(diào)劑 +11 | zjl的號 2026-03-16 | 16/800 |
|
|
[考研]
|
zhouzhen654 2026-03-16 | 3/150 |
|