Item 24. Member Function Lookup
When a member function is called, involving three steps: 1) Compiler lookup function name 2) Select the most match 3) check from the valid candidate function to the selected function and the function to access
Understand the following code from this perspective: Class B {public: // ... void f (double);}; Class D: public b {void f (int);}; // ... D D; DF (12.3 ); // confusing
That is the time to call B :: F (double) or D :: f (int)? Analyze the three steps: 1) Look for function names. Because it is called D's object, the starting domain looking for is D, so I only find D :: f (int) (why not find B :: f (double)?, I am also wondering!) 2) The most matching is selected in the candidate function. Only D :: F (int), that is, it 3) check access. Because D :: f (int) is private, so an error,
Is this so really this? That's, I know it.