首页 > 学院 > 开发设计 > 正文

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

2019-11-11 05:10:16
字体:
来源:转载
供稿:网友
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace 构造函数{    class 构造函数    {        //如果程序员手动定义了任何一款构造函数,那么系统底层不在帮我们生成构造函数        //构造函数作用:构造一般和new关键字连用,做类成员的初始化工作        //构造函数分类:        public 构造函数(string name)        {              //带参构造函数        }        public 构造函数()        {            //无参构造函数        }    }}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表