first i copy an object byte by byte to a memory location .
Then cast starting address of that memory location to pointer of object type and access member function of object using that pointer .

code is very lengthy and split across files ..
so i was avoiding to post it.

gcc compiler is giving following error
10.cpp: In function ‘int main()’:
10.cpp:64: error: request for member ‘display’ in ‘(hen*)henstash.Stash::fetch(j)’, which is of non-class type ‘hen*’


henstash.Stash::fetch(j) is returning a void pointer to memory location where object was earlier copied byte by byte.
hen is class.

post something that needed... Stash::fetch(...???...)

>first i copy an object byte by byte to a memory location
It's one of the most dangerous operations (in general case illegal and erroneous), as usually symptom of a very bad code design.

The only valid conversion void* to type* value is: the void* pointer value was obtained previously from a valid type* pointer.

Present all line#64 statement where an error was detected.

i have figured the problem in my code and coversion can be done

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.