How do I get my cat to use a cat flap?

Cats learn by observation to use door handles and open the door although only a few cats will do this. Confidence and intelligence apply.