The compiler finds an element named
func
in the
A
class namespace, so it stops the search. An element named
func
in the
A
class does not have to be a function - it can be a regular class member. There can be many such elements - for example, an overloaded function. Next, the compiler searches for the most appropriate function among the found elements with the same name, which can be called with these arguments without converting the types of arguments or with an implicit conversion of the type of arguments of the function. In this case, it is void
A::func(int)
; See also
C++ lookup rules.
Login in to like
Login in to comment