String.h
template<typename T>
class String
{
public:
...
StringIterator<T> createIterator(size_t k = 0);
...
};
////////////////////////////////////////////////////////////////////////////////////////////////////
template<typename T>
class StringIterator
{
};
String.cpp
#include "String.h"
template class String<char>;
template class StringIterator<char>;
////////////////////////////////////////////////////////////////////////////////////////////////////
...
template<typename T>
StringIterator<T> String<T>::createIterator(size_t k)
{
return StringIterator<T>();
}
...
Ошибки:
...
1> String.cpp
1>c:\users\имя\downloads\lr02\lr02\string.h(62): error C2143: syntax error: missing ';' before '<'
1> c:\users\имя\downloads\lr02\lr02\string.h(73): note: see reference to class template instantiation 'String' being compiled
1>c:\users\имя\downloads\lr02\lr02\string.h(62): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\имя\downloads\lr02\lr02\string.h(62): error C2238: unexpected token(s) preceding ';'
1>c:\users\имя\downloads\lr02\lr02\string.h(62): fatal error C1903: unable to recover from previous error(s); stopping compilation