I read one of the book which deals with the issues of member function binding in c++.
and it's giving the next example:
void Window::oops() { printf("Window oops\n"); }
void TextWindow::oops() {
printf("TextWindow oops %d\n", cursorLocation);
Window win;
Window *winPtr;
TextWindow *txtWinPrt = new TextWindow;
win = *txtWinPrt;
winPtr = txtWinPtr;
win.oops(); // executes Window version
winPtr->oops(); // executes TextWindow or Window version;
I didn't understand why win.oops
would executes window version? win is defined as Textwindow.
Thank you for your help.