title: How can I determine whether a Delphi object is of a specific class and not any descendant class?
body: <p>I have these classes and a procedure:</p>
  
  <pre><code> TParent = class(TObject);
   TChild1 = class(TParent);     
   TChild2 = class(TParent);
  
   Procedure DoSomething(obj:TParent);
  </code></pre>
  
  <p>What I would like to do is when <code>obj</code> is a <code>TParent</code> and not a descendant raise an exception.</p>
  
  <p>I thought about doing something like this:</p>
  
  <pre><code>if obj.classname = TParent.classname then raise exception.create....
  </code></pre>
  
  <p>but it seems a bit <em>hackish (TM)</em></p>
  
  <p><strong>More:</strong> What i intended is to able to pass objects that shared properties/procedures in common. After more thought, the TParent Object isn't really needed at all, what i needed was an interface object shown in my answer.</p>