title: Writing a generic class to handle built-in types
body: <p>Not too practical maybe, but still interesting.</p>
  
  <p>Having some abstract question on matrix multiplication I have quickly implemented a matrix for ints, then tested my assumptions.</p>
  
  <p>And here I noticed that just int matrix is not good, if I occasionally want to use it with decimal or double. Of course, I <em>could</em> try just to cast all to double, but that's not convenient way.</p>
  
  <p>Continue with assumption we could have a bunch of objects we are able to add and multiply - why don't use them in my matrix?</p>
  
  <p>So, just after considering it would be a Matrix class now I faced that generic T could not be used, I need it to support some interface which could add and multiply.</p>
  
  <p>And the problem is I could override operators in my class, but I could not introduce an interface which would support operators. And I have an operators in built-in types, but still no interface over them.</p>
  
  <p>What would you do in such a case considering you do not want to duplicate worker class body? Wrappers and implicit casting didn't help me much, I'm interested in a beautiful solution.</p>
  
  <p>Thanks.</p>