c++ - display the value from generic pointer -


i have void pointer contains address of object not types of object. code like

variant vtprop; 

now getting value in vtprop using method. it's have values.

now have assign value in void pointer

void *ptr = vtprop.pparray; 

now getting array of object. need object void pointer when displaying value in void pointer using

wcout << ptr << endl; 

it displaying address contains in void pointer.

could please suggest me how print object name.

this prints address:

void *ptr = vtprop.pparray; wcout << ptr << endl; 

because overload of operator<<, takes void* applied. in case ptr points object has member name, should do:

myobject* ptr = reinterpret_cast<myobject*>(vtprop.pparray); wcout << ptr->name << endl; 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -