powered by simpleCommunicator - 2.0.59     © 2025 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / C++ [игнор отключен] [закрыт для гостей] / Ошибки в шаблоне
3 сообщений из 3, страница 1 из 1
Ошибки в шаблоне
    #38377030
greenpo1son
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Не могу понять в тем ошибка... Вот часть кода:

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
template < class T> class Iterator
{
public:
	Itrator(ArrayList<T>&);
	bool hasNext();
	T &operator++();
	T &operator--();
	T &operator()(int);
	T &remove();

private:
	int seek;
	ArrayList<T> *obj;
}; 

template < class T> Iterator<T> :: Iterator(ArrayList<T>& obj)
{
	this -> obj = &obj;
}

template < class T> bool Iterator<T> :: hasNext()
{
	return seek < obj -> size();
}

template < class T> T &Iterator<T>  :: operator++()
{
	return obj -> get(seek++);
}

template < class T> T &Iterator<T> :: operator--()
{
	return obj -> get(--seek);
}

template < class T> T &Iterator <T> :: operator()(int index)
{
	return obj -> get(index);
}

template < class T> T &Iterator <T> :: remove()
{
	return obj -> remove(seek);
}
 
#endif



Ошибки:

Ошибка 38 error C2039: --: не является членом "`global namespace'" d:\vc c++ temp\arraylist\arraylist\arraylist.h 251 1 ArrayList

Ошибка 48 error C2039: (): не является членом "`global namespace'" d:\vc c++ temp\arraylist\arraylist\arraylist.h 256 1 ArrayList

Ошибка 34 error C2039: ++: не является членом "`global namespace'" d:\vc c++ temp\arraylist\arraylist\arraylist.h 246 1 ArrayList

Ошибка 24 error C2039: hasNext: не является членом "`global namespace'" d:\vc c++ temp\arraylist\arraylist\arraylist.h 241 1 ArrayList

Если нужно могу выложить весь код
...
Рейтинг: 0 / 0
Ошибки в шаблоне
    #38377032
greenpo1son
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
И да ошибки ссылаются именно на этот участок кода.

И если надо вот объявление ArrayList
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
template<class T> class ArrayList 
{
 
friend class Iterator <T>;
friend ostream &operator<<(ostream &,ArrayList &);
 
public:
    explicit ArrayList(int = 10);
    virtual ~ArrayList();
    void add(T&);
    int size();
    T &get(int);
    T &get(int) const;
    bool contains(const T&);
    T &remove(int);
	Iterator <T> &iterator();
	typedef Iterator<T> *ListIterator;

 
private:
    int lenght;
    T ** mas;
    void setSize(int);
    void initMas();
    int seek;
    float shift;
    void removeHelper(T **temp,int index,int count,int count2);
};
...
Рейтинг: 0 / 0
Ошибки в шаблоне
    #38381714
greenpo1son
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
решено уже давно.
...
Рейтинг: 0 / 0
3 сообщений из 3, страница 1 из 1
Форумы / C++ [игнор отключен] [закрыт для гостей] / Ошибки в шаблоне
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]