Created
January 26, 2015 15:53
-
-
Save markusjohnsson/484802537b90b51e6e89 to your computer and use it in GitHub Desktop.
Illustrating the problem with named parameters and interfaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
class Coord : ICoord | |
{ | |
public void Print(double lat, double lon) | |
{ | |
Console.WriteLine("Lon: {0}, Lat: {1}", lon, lat); | |
} | |
} | |
interface ICoord | |
{ | |
void Print(double lon, double lat); | |
} | |
public class Program | |
{ | |
public static void Main() | |
{ | |
Coord coord = new Coord(); | |
coord.Print(lat: 11, lon: 44); | |
ICoord icoord = (ICoord)coord; | |
icoord.Print(lat: 11, lon: 44); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment