static void Main(string[] args)
        {
            // The interface is covariant.
            ICovariant <Button> ibutton = new SampleImplementation <Button>();
            ICovariant <Object> iobj    = ibutton;

            // The class is invariant.
            SampleImplementation <Button> button = new SampleImplementation <Button>();
            // The following statement generates a compiler error
            // because classes are invariant.
            // SampleImplementation<Object> obj = button;


            var y = new SampleImplementation <int>();

            y.M(0);
        }
Пример #2
0
 public ProxyImplementation()
 {
     _impl = new SampleImplementation();
 }