Not too practical maybe, but still interesting.
Having some abstract question on matrix multiplication I have quickly implemented a matrix for ints, then tested my assumptions.
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 could try just to cast all to double, but that's not convenient way.
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?
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.
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.
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.
Thanks.