标签:
Email整体项目
Email类 using System; using System.Collections.Generic; using System.Linq; using System.Text; using Service; namespace Email { public class email:Ifiles { public void GetEmail() { Console.WriteLine("发送邮件了"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Service; namespace Email { public class EmailFactory:IfileFactory { public Ifiles Create() { return new email(); } } //public class EmailFactory : PhoneFactory //{ // public Phone Create() // { // return new Phones(); // } //} }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Service; namespace Email { //public class Phones:Phone // { // public void GetPhone() // { // Console.WriteLine("发送短信了"); // } // } }
引用其他类
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Service { public interface Ifiles { void GetEmail(); } //public interface Phone //{ // void GetPhone(); //} }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Service { public interface IfileFactory { Ifiles Create(); } //public interface PhoneFactory //{ // Phone Create(); //} }
使用
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Service; namespace Email { class Program { static void Main(string[] args) { Ifiles em = (new EmailFactory()).Create(); em.GetEmail(); Console.ReadKey(); } } }
标签:
原文地址:http://www.cnblogs.com/mengluo/p/5735433.html