title: C#'s "where T : type" in C++
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/122316/template-constraints-c">Template Constraints C++</a>  </p>
  </blockquote>
  
  
  
  <p>I am wondering  if I can check to see if type T inherits a certain class in my generic/templated methods. I can do this easily in C# using 'where'. For example, in my game engine, I have this concept of a generic manager that is an XNA component. It has a list of drawable objects (Could be entities, particles, etc). So my class definition is like this:</p>
  
  <pre><code>public class LayerableDrawableGenericManager&lt;T&gt; : Microsoft.Xna.Framework.DrawableGameComponent where T : Drawable
  </code></pre>
  
  <p>So we can only have a generic manager of an object that can be drawn (an object that inherits drawable). We need to be sure of this because in my generic manager, I am calling <code>Draw()</code> on all those T type objects. Without ensuring that the T type object will inherit the Drawable class (which contains the <code>Draw()</code> method), I wouldn't be able to draw my objects.</p>
  
  <p>anyway, Was wondering how this is done in C++. I've googled around for things like "Where C++" and "Where keyword C++" and all my results are things like "where can i learn C++"..</p>