Discussion in 'C++' started by asadullah.ansari, Jan 22, 2008.
This article is wrong ! The method the author describes only works for particular C++ compilers. Also the method used here is machine specific. The author has made assumptions on the size of the integer pointer which changes on different platforms. Its cool to tinker and find out how your compiler implements virtual function but this is not the same for all compilers and platforms.
There is **NOTHING** in the C++ Standard i.e. ISO/IEC 14882 (2003) that mentions how they are to be implemented. There are different ways to implementing virtual tables/pointers internally. If you want to understand how virtual functions (polymorphism) work pickup the ISO standard and start reading.
I have already read the ISO standard, after reading i thought about it. I make it and test
on solaris system. This article gives you a idea about VPTR.
Can you tell me any compiler which is behaving different that whatever i descrived?
Offcourse compiler can implement any concept in different ways. Just go and read Iso standard for VPTR how it's designed?
what's wrong. I got everything . I think you did'nt read c++ standard.
VPTR is nothing to do with the C++ Specification.
Are you sure that your explanation works for all these compilers?
IIRC, this wont work with MSVC. I have no problem with your explanation, you should mention that it will only work for x,y,z compiler under a,b,c platform. If you don't mention that, people reading your article will assume that this is a global standard for all C++ compilers.
What ISO standard? Can you quote the actual standard that describes the size of vptr as 4 bytes? You can also define vtbl in different ways.
i have mention above it's for 32 bit machine
Very Nice artical bro..........................
really nice article..
i was confusion in vtable but now i know all about vtable and vptr.......
Separate names with a comma.