There isn't really a standard way to write something like this. It's usually dependent on how similar Foo and Bar are. Is "Bar" some kind of representation of a part of "Foo", like a name or an ID (in which case, it would probably be get_bar)? Is "Bar" a handle that you can use to edit part of "Foo" (in which case, it would be named something like open_bar or slice_bar)? Is "Bar" an object that will exist within "Foo" (in which case, it would be something like add_bar)?
So in my particular case, I have a "NumEnv" class, which holds things like blas handles / gpu handles / etc ... and I am curently having this class create Tensors for me, so something like: