Here concept of v-tables comes into picture. Refer to C++ Primer Plus by Stephen Prata.
Sanju :) On Sun, Aug 21, 2011 at 11:05 PM, JAIDEV YADAV <jaid...@gmail.com> wrote: > because Access control check is done at compile time while using virtual > make fun not available to the base class pointer till runtime ... so no > access check to derived class ... hope u understand and correct me to if > there is any mistake ... > > > On Mon, Aug 22, 2011 at 10:57 AM, Decipher <ankurseth...@gmail.com> wrote: > >> class Base >> { >> public : >> virtual void show() >> { >> cout<<"\n Base "; >> } >> >> }; >> class Derived : public Base >> { >> private : >> void show() >> { >> cout<<"\n Derived "; >> } >> }; >> int main() >> { >> Base *d = new Derived(); >> d->show(); >> getch(); >> } >> >> Why Derived::show is called even though it is private ? (Ran this code on >> Dev - C++) >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/algogeeks/-/MKvMpI_KOLUJ. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > > > -- > JaiDev Yadav > (National Yoga Champion) > Computer Engg. Dept. > National Institute of Technology > Kurukshetra,Haryana > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.