qualified name is not allowed @hash::NumberOfItemsIndex

Solved by putting everything in one class. Best solution I could think of hope it helps someone

I keep getting an error saying
qualified name is not allowed @hash::NumberOfItemsIndex "int hash0::NumberOfItemsIndex(int index)"



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
int hash0::NumberOfItemsIndex(int index)
{
	int count = 0;

	if (HashTable[index]->title == "empty")
	{
		return count;
	}
	else
	{
		count++;
		item* Ptr = HashTable[index];
		while (Ptr->next != NULL)
		{
			count++;
			Ptr = Ptr->next;
		}
	}
	return count;
}


Here's the class it worked fine before I started developing with Forms while building a GUI

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

	//hash table
	class hash0  {

	private:
		static const int tableSize = 2;

		struct item {
			string title, summary, genre, releaseDate, filmingLocations, language, runtime;
			item* next;
		};

		item* HashTable[tableSize];


	public:
		hash0();
		int Hash(string key);
		void AddItem(string title, string summary, string genre, string releaseDate, string filmingLocations, string language, string runtime);
		int NumberOfItemsIndex(int index);
		void PrintTable();
		void PrintItemsInIndex(int index);
		void FindSummary(string title);


	};
Last edited on
class hash0 : public hash0 {

Is that a typo? It makes no sense for something to inherit itself. (Unless we're talking about Curiously Recurring Template Pattern, which is a slightly different topic.)

10:23: error: invalid use of incomplete type 'class hash0'
10:8: error: forward declaration of 'class hash0'


Since you're getting a compiler error, I suggest making a backup of your code, and then strip out everything in your code that is not causing the problem, until you get to the absolute minimal amount of code needed to reproduce your problem. That will increase the likelihood of someone here being able to help you.
Last edited on
Yeah it was a typo

Hmm the issue is with GUI version I'm making. it worked when I was using header files in the non GUI version, the only error in the program is that
Topic archived. No new replies allowed.