The interface:
interface IPlay<
T>
{ }
Classes:
class Mp3Player : IPlay<
int>
{ }
class OggPlayer : IPlay<
double>
{ }
class DummyPlayer : IPlay<
object>
{ }
Trying to use :
1. IPlay<
object>
player = new Mp3Player ();
2. IPlay<
int>
player2 = new OggPlayer ();
A Big why 1 and 2. usages can not cast?
int to object, or, int to double. It's possible in nongeneric cases. Is there any other method?