using System;
public class Program
{
public static void Main()
{
IRobot r = new Robot();
r.SaySomething();
}
}
public class Machine
{
public void SaySomething()
{
Console.WriteLine("Hello");
}
}
public interface IRobot
{
void SaySomething();
}
public class Robot : Machine, IRobot
{
// and we don't have to implement IRobot here
}
Live Code: https://dotnetfiddle.net/cqdt8z
Output:
Hello
I still have to find a use for that code found somewhere
Happy Coding!
No comments:
Post a Comment