第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

解釋一下代碼

解釋一下代碼

瀟瀟雨雨 2018-11-26 15:17:51
 public PersonController()            : this(new PersonBLL()) { }
查看完整描述

2 回答

?
繁花如伊

TA貢獻(xiàn)2012條經(jīng)驗(yàn) 獲得超12個贊

 using System;
  2 using System.Collections.Generic; 
  3 using System.Linq;
  4 using System.Text;
   5 
    6 
    namespace ConsoleApplication1
     7 
     {
      8  
        class Program
        9    
         {
         10       
           static void Main(string[] args)11     
               {12             PersonBLL p = new PersonBLL();
               13    
                        PersonController pc = new PersonController(p); //初始化帶參構(gòu)造函數(shù)14         
                            //輸出:初始化了帶參構(gòu)造函數(shù)15             Console.WriteLine("---------------------------------");16             PersonController pc1 = new PersonController();//初始化無參構(gòu)造函數(shù)17             //輸出:初始化了帶參構(gòu)造函數(shù)18             //      初始化了無參構(gòu)造函數(shù)19         }20     }21 22     public class PersonController23     {24         private PersonBLL personBLL;25 26         public PersonController(PersonBLL p)27         {28             this.personBLL = p;29             Console.WriteLine("初始化了帶參構(gòu)造函數(shù)");30         }31 32         public PersonController()33             : this(new PersonBLL())34         {35             Console.WriteLine("初始化了無參構(gòu)造函數(shù)");36         }37     }38 39     public class PersonBLL40     {41     }42 }

在調(diào)用無慘構(gòu)造函數(shù)的時候,會先初始化帶參構(gòu)造函數(shù),再明白了吧


查看完整回答
反對 回復(fù) 2018-11-30
?
眼眸繁星

TA貢獻(xiàn)1873條經(jīng)驗(yàn) 獲得超9個贊

PersonController類里面有一個構(gòu)造函數(shù) public PersonController(PersonBLL p)

直接調(diào)用該構(gòu)造函數(shù)初始化了public PersonController()


查看完整回答
反對 回復(fù) 2018-11-30
  • 2 回答
  • 0 關(guān)注
  • 432 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號