Jul-21-2021, 02:57 AM
normally foo just means something arbitrary. in this case it was the class the caller was expecting to get an instance of, the method which would choose to make an instance of some other class that caller does not know about.
a poor example of this is a class that opens a file that may, or may not, be filtered in some way. if the method determines that no filtering is needed, that the objective is to return an instance of file class instead of an instance of itself (it would do the filtering, if needed). i give this example as a way to understand what i'm trying to do, not the details to find some other way to do this, i was originally trying to do this with a front end function to decide which class is needed.
a poor example of this is a class that opens a file that may, or may not, be filtered in some way. if the method determines that no filtering is needed, that the objective is to return an instance of file class instead of an instance of itself (it would do the filtering, if needed). i give this example as a way to understand what i'm trying to do, not the details to find some other way to do this, i was originally trying to do this with a front end function to decide which class is needed.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.