Defining double exclamation?
===

I understand what a double exclamation mark does (or I think I understand) but I am not sure how it is defined on a random object. For example in the code snippet below:


    Assignment *a;
    if (!getAssignment(query, a))
       return false;
    hasSolution = !!a;
  
    if (!a)
       return true;

How do I know what value will the double exclamation mark result in ? In other words does it always convert to true ? false ? or can you define a behavior for it such as executing a method to determine the result (how does the object know how to act in this situation) ? I am bit confused about this piece of code due to all these exclamation stuff going on.. Any explanation is appreciated. 

Hope I was clear and thanks.