Skip to content

Instantly share code, notes, and snippets.

@huanlin
Created November 25, 2014 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save huanlin/2ce78c85196ae136f62a to your computer and use it in GitHub Desktop.
Save huanlin/2ce78c85196ae136f62a to your computer and use it in GitHub Desktop.
Unity Example 6-2
public interface IMessageService
{
void SendMessage(string to, string msg);
}
public class EmailService : IMessageService
{
public void SendMessage(string to, string msg)
{
Console.WriteLine(" 透過 EmailService 發送郵件給 {0}。", to);
}
}
public class SmsService : IMessageService
{
public void SendMessage(string to, string msg)
{
Console.WriteLine(" 透過 SmsService 發送簡訊給 {0}。", to);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment