How does a cell separate itself from its environment and still allow materials to leave and enter the cell in order to maintain homeostasis?

it has a selectively porous cell wall.