calling selectors in .mm but not in .h file-Collection of common programming errors

I wanted to check my understanding of what’s going in this example regarding selectors:

Suppose I have an NSArray of Foo objects called arr in Bar.m. In Foo.m, I have a (NSComparisonResult)compareFoo: method, but I forget to declare in the Foo.h file. Yet, when I call [arr sortedArrayUsingSelector:@selector(compareFoo:)]; the code runs fine. Is this because the message compareFoo: is getting sent to the objects in the array, which are Foo objects, so they can call compareFoo: even if it’s not declared in Foo.h?

Wasn’t 100% sure about this and got curious. Thanks!