Luuk
2015-10-16 08:46:04 UTC
On this page i found an interssting example of an interface:
http://www.c-sharpcorner.com/UploadFile/sekarbalag/interface-best-example-in-csharp/
Here two interfaces are created for a Class named ODDEVEN
The first has methods ONE,THREE,FIVE
The second has methods TWO,FOUR
I was looking at this, and thought i did understand this ;)
So i created another interface SMALLER3 like this:
interface SMALLER3 : IOne,ITwo
{
}
The program:
Console.WriteLine("\n\nThis is SMALLER3");
SMALLER3 obj3 = new ODDEVEN(); // <-- CS0266
obj3.TWO();
obj3.ONE();
If fails with:
CS0266 Cannot implicitly convert type 'InterfaceDemo.ODDEVEN' to
'InterfaceDemo.SMALLER3'. An explicit conversion exists
Can someone give a hint to this?
http://www.c-sharpcorner.com/UploadFile/sekarbalag/interface-best-example-in-csharp/
Here two interfaces are created for a Class named ODDEVEN
The first has methods ONE,THREE,FIVE
The second has methods TWO,FOUR
I was looking at this, and thought i did understand this ;)
So i created another interface SMALLER3 like this:
interface SMALLER3 : IOne,ITwo
{
}
The program:
Console.WriteLine("\n\nThis is SMALLER3");
SMALLER3 obj3 = new ODDEVEN(); // <-- CS0266
obj3.TWO();
obj3.ONE();
If fails with:
CS0266 Cannot implicitly convert type 'InterfaceDemo.ODDEVEN' to
'InterfaceDemo.SMALLER3'. An explicit conversion exists
Can someone give a hint to this?