title: What is Single and Double Dispatch?
body: <p>i have wrote the visitor pattern as follow but i don't understand what is single and double dispatch. 
  AFAIK, single dispatch is invoke a method based on caller type where double dispatch is invoke a method based on caller type and argument type. </p>
  
  <p>I guess double dispatch is happen in single class hierarchy but why visitor class has two class hierarchy but it still considered as double dispatch. </p>
  
  <pre><code>void floppyDisk::accept(equipmentVisitor* visitor)
  {
   visitor-&gt;visitFloppyDisk(this);
  }
  
  void processor::accept(equipmentVisitor* visitor)
  {
   visitor-&gt;visitProcessor(this);
  }
  
  void computer::accept(equipmentVisitor* visitor)
  {
   BOOST_FOREACH(equipment* anEquip, cont)
   {
    anEquip-&gt;accept(visitor);
   }
  
   visitor-&gt;visitComputer(this);
  }
  
  void visitFloppyDisk(floppyDisk* );
  void visitProcessor(processor* );
  void visitComputer(computer* );
  </code></pre>
  
  <p>Please explain using the example code i provided. </p>
  
  <p>AFAIK, the first dispatch is happen on object who invoke the accept and second dispatch is happen on object who invoke the visit method. </p>
  
  <p>Thanks. </p>