I am still quite confused about the whole thing. If the pointer points to Derv's v-table, how the hell does it even know of the virtual functions in base? That info would only be contained in base's v-table. So how exactly would the index be calculated from base?
Coming to your example Dinesh... I haven't actually seen the output but my guess would be Derived and not Derived1 as the last output. If you are saying it exhibits polymorphic behaviour and the output is Derived1, this adds to the confusion. Derv1 is derived from Derv and pr isn't virtual in Derv, then how does the pr in Derv1 get called?!
Heavens... I need a good book on this topic!
No comments:
Post a Comment