内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

java設(shè)計模式的抽象工廠模式怎么寫-創(chuàng)新互聯(lián)

本文小編為大家詳細介紹“java設(shè)計模式的抽象工廠模式怎么寫”,內(nèi)容詳細,步驟清晰,細節(jié)處理妥當,希望這篇“java設(shè)計模式的抽象工廠模式怎么寫”文章能幫助大家解決疑惑,下面跟著小編的思路慢慢深入,一起來學(xué)習(xí)新知識吧。

成都創(chuàng)新互聯(lián)是一家集網(wǎng)站建設(shè),洛龍企業(yè)網(wǎng)站建設(shè),洛龍品牌網(wǎng)站建設(shè),網(wǎng)站定制,洛龍網(wǎng)站建設(shè)報價,網(wǎng)絡(luò)營銷,網(wǎng)絡(luò)優(yōu)化,洛龍網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強企業(yè)競爭力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時我們時刻保持專業(yè)、時尚、前沿,時刻以成就客戶成長自我,堅持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實用型網(wǎng)站。
public class UserEntity
    {
        public int ID { get; set; }
        public string Name { get; set; }
    }

public interface IUser
    {
        void InsertUser(UserEntity user);
        UserEntity GetUser(int id);
    }
class SqlUser: IUser
    {
        public void InsertUser(UserEntity user)
        {
            Console.WriteLine("在SQL中插入一個用戶");
        }
        public UserEntity GetUser(int id)
        {
            Console.WriteLine("在SQL中獲取一個用戶");
            return null;
        }
    }

    class AccessUser : IUser
    {
        public void InsertUser(UserEntity user)
        {
            Console.WriteLine("在Access中插入一個用戶");
        }
        public UserEntity GetUser(int id)
        {
            Console.WriteLine("在Access中獲取一個用戶");
            return null;
        }
    }

    //抽象工廠改簡單工廠->反射
    public class SimpleFactory
    {
        private static string assemblyName = "抽象工廠";        
        private static string db = ConfigurationSettings.AppSettings["DB"];        
        public static IUser CreateUser()
        {
            //switch (db)
            //{
            //    case "sql":return new SqlUser();
            //    case "access": return new AccessUser();
            //}
            //return null;      
            string className = assemblyName + "." + db + "User";
            IUser iuser = (IUser)Assembly.Load(assemblyName).CreateInstance(className);
            return iuser;
        }

        public static IDepartment CreateIDepartment()
        {            
            string className = assemblyName + "." + db + "Department";
            IDepartment department = (IDepartment)Assembly.Load(assemblyName).CreateInstance(className);
            return department;
        }
    }
        <appSettings>
    <add key="DB" value="Product.Sql"/>
  </appSettings>

    static void Main(string[] args)
        {
            //UserEntity user = new UserEntity();
            //IFactory factory = new AccessFactory();
            //IUser su = factory.CreateUser();
            //su.InsertUser(user);
            //su.GetUser(1);

            //DepartmentEntity department = new DepartmentEntity();
            //IDepartment de = factory.CreateDepartment();
            //de.InsertDepartment(department);
            //de.GetDepartment(1);
            //Console.ReadLine();

            UserEntity user = new UserEntity();
            DepartmentEntity department = new DepartmentEntity();
            IUser su = SimpleFactory.CreateUser();
            su.InsertUser(user);
            su.GetUser(1);
            IDepartment dep = SimpleFactory.CreateIDepartment();
            dep.InsertDepartment(department);
            dep.GetDepartment(1);
            Console.ReadLine();

        }

讀到這里,這篇“java設(shè)計模式的抽象工廠模式怎么寫”文章已經(jīng)介紹完畢,想要掌握這篇文章的知識點還需要大家自己動手實踐使用過才能領(lǐng)會,如果想了解更多相關(guān)內(nèi)容的文章,歡迎關(guān)注創(chuàng)新互聯(lián)網(wǎng)站制作公司行業(yè)資訊頻道。

創(chuàng)新互聯(lián)www.cdcxhl.cn,專業(yè)提供香港、美國云服務(wù)器,動態(tài)BGP最優(yōu)骨干路由自動選擇,持續(xù)穩(wěn)定高效的網(wǎng)絡(luò)助力業(yè)務(wù)部署。公司持有工信部辦法的idc、isp許可證, 機房獨有T級流量清洗系統(tǒng)配攻擊溯源,準確進行流量調(diào)度,確保服務(wù)器高可用性。佳節(jié)活動現(xiàn)已開啟,新人活動云服務(wù)器買多久送多久。

本文名稱:java設(shè)計模式的抽象工廠模式怎么寫-創(chuàng)新互聯(lián)
網(wǎng)站地址:http://www.rwnh.cn/article8/cejiop.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供移動網(wǎng)站建設(shè)、ChatGPT網(wǎng)站排名、外貿(mào)網(wǎng)站建設(shè)域名注冊、網(wǎng)站維護

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化
罗田县| 右玉县| 武山县| 临桂县| 屯昌县| 宁强县| 小金县| 黔东| 苍山县| 甘孜| 九寨沟县| 邓州市| 岚皋县| 珠海市| 河曲县| 夏邑县| 金门县| 洛隆县| 日照市| 临夏县| 佛冈县| 年辖:市辖区| 沂水县| 贡嘎县| 苏尼特右旗| 新闻| 巴东县| 赤城县| 五峰| 嵩明县| 新野县| 武汉市| 蒙阴县| 大理市| 左权县| 吴桥县| 嘉鱼县| 双峰县| 阳江市| 集安市| 海南省|