Member Avatar for Oritm

I created a map<string, void*>.
The void* used to store an Object from a class called Window.

I can cout a string with the following:

it = windowMap.find(title);
	if( it != windowMap.end() ) 
	{
		cout << "Value is: " << it->first << '\n';
	} else {
		cout << "Key nog found" << '\n';
	}

So i can cout the string, but what i want to do is use the void*.
I figured that i have to use it->second, but i use functions of the class window.

it->second->getTitle();

Will of course not work.
How do I do that then?

try it as follows

Window *w=(Window *)it->second;
/*or (Window *)(it->second)      if the former gives error*/
w->getTitle();
Member Avatar for Oritm

Thanks, works like a charm!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.