Check if password protected post is visible

Is there anyway of checking if a password protected post is visible / not visible? I want some thing that says this;

If the post is password protected (that parts fine) and the correct password hasn’t been entered, then show ‘XXX’, else show ‘ZZZ’.

Solutions Collecting From Web of "Check if password protected post is visible"