我是一個新手模板,所以請原諒我天真的問題。我得到的錯誤在此代碼:「使用類模板需要模板參數列表」是什麼意思?
template <class t>
class a{
public:
int i;
a(t& ii):i(ii){}
};
int main()
{
a *a1(new a(3));
cout<<a1.i;
_getch();
}
編譯錯誤:
'a' : use of class template requires template argument list
'a' : class has no constructors
我不認爲這是很好的downvote問題,只是因爲一些天真被問......我不你不認爲你,迪翁沃特先生,在你的職業生涯中從來沒有通過這個舞臺,因爲你不明白這一點,或者你不清楚 –
非常感謝你們!你是一個很好的地方......可以毫不嘲諷地回答幼稚的問題:)) –
@Armen:公平地說,我們正在談論一個存在的C++書會回答的問題。 –