Veeru wrote:
>
Murali Krishna wrote:
>Veeru wrote:
Murali Krishna wrote:
Veeru wrote:
Hi ,
What is the data type of Vptr pointer used in the virtual funtion
mechanism?
i suppose its void. Please correct me if i am wrong...
Regards,
Veeru
your question was answered in Marshall Cline's FAQs
see this..
http://www.parashift.com/c++-faq-lit....html#faq-20.4
-- Murali Krishna
i searched in the FAQ but didnt find the answer to my question. i
wanted to know the data type of the Vptr pointer the points to the
Vbtl(virtual table) which contains the function pointers to virtual
functions.
Please help.
Regards,
Veeru
I think you have faced this in an interview. I have not seen about
VPtr's data-type till now. but as written in FAQs, you can understand
that it is a generic pointer (say void*) to a generic member function
because it stores the starting address of the V-Table.
I guess it is void*.
-- Murali Krishna.
Thanks Murali for such a quick response.
There are two possibilities as far as i can see now:
1. Either Vptr could be a void *
OR
2. V-Table must be some kind of an internal hidden sturture or class.
And the Vptr points to the V-Table. So Vptr could have a data type of
V-Table.
Well, this is just what i can guess.
But still need a confimation.
There is no way to confirm this: the c++ standard does not even require that
v-tables exist. In particular, it does not prescribe the types and data
structures used to implement the dispatch mechanism for virtual functions.
Thus, your question does not have a general answer. If you are interested
in how a given implementation does it, then you should ask your question in
a forum dedicated to that particular implementation.
Best
Kai-Uwe Bux