Apes, like humans, are capable of pretend play, challenging long-held views about how animals think, a new study suggests.