title: C++ Implementing an interface in two different classes
body: <p>I'm trying to abstract a common interface for my gui implementation but I'm having a hard time figuring out how to do this cleanly. Here's a simplified version of what I'd like to achieve.</p>
  
  <pre><code>class IBorderable
  {
      virtual unsigned int getBorderWidth(BorderIndex index) const = 0;
      virtual void setBorderWidth(BorderIndex index, unsigned int width) = 0;
  };
  
  class Square : public IBorderable
  {
      // Implement while limiting BorderIndex to only 4
      // Calling with invalid BorderIndex is handled at compile time
  };
  
  class Cube : public IBorderable
  {
      // Implement while limiting BorderIndex to only 6
  };
  </code></pre>
  
  <p>Ideally, I'd like to do this through polymorphism without any conditional checks to make sure BorderIndex is within bounds. Is it possible to have it throw an error at compile time? I would have liked to use strongly typed enums but they can't be derived.</p>