What plant was that?
One of the first things I learned about plant reproduction is that some plants do things very differently than others.
Some have both male & female parts in each flower, and expect to pollinate themselves (peas & tomatoes). Some have male & female parts in each flower, but often have bees or something to do the pollinating (onions, carrots, I think broccoli.)
Some plants have both male and female parts, but they are in different flowers (squash) or different parts of the plant (corn.)
Some plants have separate male and female plants (spinach, asparagus.) For at least some of those kinds of plants, each gender will sometimes make some of both parts anyway (like male asparagus making a few berries.)
I've read that mulberry trees can be all male, or all female, or make flowers of both kinds, and they supposedly can change from one year to another or even within a single year. I have mulberry trees in my own yard, but as far as I can tell they all make berries, so I must not have any all-male ones