0

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.

3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by gumber
0

>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.

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.