When a child class function is called, the compiler looks first for a matching function name in the _____ A. class of the object using the function name B. immediate ancestor class C. base class D. descendant class

class of the object using the function name
immediate ancestor class
base class
descendant class

The correct answer is: A. class of the object using the function name

When a child class function is called, the compiler looks first for a matching function name in the class of the object using the function name. If a matching function is found in the class of the object, then that function is called. If no matching function is found in the class of the object, then the compiler looks for a matching function in the immediate ancestor class. This process continues until a matching function is found or until all ancestor classes have been searched. If no matching function is found in any of the ancestor classes, then a compiler

error is generated.

Option B is incorrect because the compiler looks for a matching function in the class of the object using the function name, not in the immediate ancestor class.

Option C is incorrect because the compiler looks for a matching function in the class of the object using the function name, not in the base class.

Option D is incorrect because the compiler looks for a matching function in the class of the object using the function name, not in the descendant class.