Frankly, I don't understand the practical importance of vtable. For me it is just a theoretical concept which needs to be mugged up since interviewer will ask it surely. Can anyone shed some light on it that why interviewers love vtable? I don't see how knowledge of vtable makes me a competent c++ developer :-|
|
migrated from stackoverflow.com May 31 '11 at 18:40
|
It shows that you know how the |
|||||||||||||||||||||
|
|
Knowledge of what a vtable is does not make you a competent C++ developer; however, lack of that knowledge does imply that you are not a skilled C++ developer. |
|||||||||||||||||||||
|
|
Because tech interviewing is broken. The interviewer doesn't know how to actually determine whether you can pad their bottom line -- in fact, I doubt they even have a clue just what their (company's) bottom line is! Someone that is smart and gets things done can look up all they need to know about vtables with a quick search. As I said up above, I used to do a lot of COM programming, and had to deal with vtables somewhat. But I never had to deal with them in general/generic C++ programming. EDIT: Up above, we see a prime example of just how broken this process is: Someone is claiming that if you don't know how vtables are implemented, then you don't know C++ and are, in fact, incompetent. I've been lucky to have known 2 programmers that have been almost singlehandedly responsible for millions in revenue... and neither one of them knew about vtables. One knew design patterns like the back of his hand, but the other was just barely above the "C with classes" level and apparently never heard of the DRY principle. But they could both crank out code, and both made good products that were rock-solid and well-built. |
|||||||||||||||||||
|
|
Like for any "good to know but not essential" concept, knowing what a vtable is shows that you know more than the average programmer. |
|||||
|
|
Inheritance is an important object-oriented concept and c++ supports it. Almost all c++ frameworks use it in one way or the other. In c++, inheritance involves the usage of virtual methods. Testing the knowledge of how its all stitched up by the language, is a good way to measure your experience with c++. |
|||||||||
|
|
It's just one way of checking if you know something. And I don't really enjoy that it's the deciding factor in a lot of places.
Maybe it's just a coincidence, but every project that had runtime-polymorphism, vtabled classes, pure virtual classes were nightmare to maintain. Overengineered, spaghetti code, diamond problems, non virtual destructors, poor copy construction logics etc. Ok, every good C++ programmer should be familiar with these concepts, and most gotchas that come with it, but why there is so much accent on this dangerous and overabused topic in interviews, I have no idea. |
|||
|
|
I'm one of the interviewers at my company, and we ask a lot of details about C and C++ coding (yes, separately). I don't recall anyone asking about vtables in the interviews. Inheritance and polymorphism concepts, yes, but not vtables as such. If you can properly and concisely explain what the keyword Ahem. I'm not sure where you're interviewing, but there are good jobs and workplaces out there that don't ask about vtables. |
|||||||||||||
|
|
Knowing about the vtable internals, you know how C++ differs from C. And other stuff such as overriding, inheritance etc. |
|||||||||||||||||
|
|
+1 for being in the same boat. I was recently asked how virtual functions are implemented. I said that it is done usng V-Tables but didnt know the actual mechanism. The interviewer was pretty displeased and this was one of the questions that got me rejected. I dont see how knowing V-Tables is a must have for a C++ programmer. Can I manipulate the VTable? No? Can I manually create one? No? Does knowing it help me tweak its performance? No? Can I atleast see it? No? So what benefit does it provide to know it? For instance , does knowing how the English language evolved make me a better speaker? No. Does knowing how the human brain makes sence of speech help me improve my language skills. No! I would rather spend my time knowing the things I can use. But apparently this is lost on the "superstar" interiviewers who seem to have more time to learn how it done rather than to do it! It is just so fashionable to ask the VTable thinng that you wounldnt want to be caught dead not wearing it. |
|||
|
|
|
If you know what a vtable is, there's a good chance that you have a pretty good knowledge of C++ and can muck around with lower level programming if need be. I'd have no qualms with a company considering hiring someone based on the fact that they know how vtables work. That said, I'd have a huge problem with a company that refuses to hire someone because they don't know how vtables work -- even for a C++ job. |
|||
|
|
