Why is feature2D::detect not implemented in source code, but can get the result of feature point detection?

that looks like you’re in the interface.

a Feature2D is non-specific. it has no single implementation. it’s a container for implementations to fill with data.

look for derived classes, or classes that use/contain Feature2D. those will actually implement behavior.