There's a subtle difference in "ownership." Co-op owners own the entire building, co-operatively.
However. If you pass away, your family can certainly inherit it, but most co-ops have rules against renting, in which case, your heirs would either have to move in or sell it.
Of course, some condos have rental restrictions, too.
In all probability, your heirs would prefer to sell, anyway!