构造函数 定义,作用,分类

来源:互联网 发布:网络机顶盒av接口 编辑:程序博客网 时间:2024/05/07 21:11
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Text;  
  5. using System.Threading.Tasks;  
  6.   
  7. namespace 构造函数  
  8. {  
  9.     class 构造函数  
  10.     {  
  11.         //如果程序员手动定义了任何一款构造函数,那么系统底层不在帮我们生成构造函数  
  12.   
  13.         //构造函数作用:构造一般和new关键字连用,做类成员的初始化工作  
  14.   
  15.         //构造函数分类:  
  16.   
  17.         public 构造函数(string name)  
  18.         {   
  19.              //带参构造函数  
  20.         }  
  21.         public 构造函数()  
  22.         {   
  23.            //无参构造函数  
  24.         }  
  25.     }  
  26. }  
                                             
0 0
原创粉丝点击