C#构造函数中的this()
2008-12-16 21:36
169 查看
using System; public class Test { public int int_x; public string str_x; public byte byte_x; public Test() { this.int_x=10; this.str_x="I love you more than I can say !"; this.byte_x=5; } public Test(string str):this() { this.str_x=str; } static void Main() { Test te=new Test("You are my sunshine.."); Console.WriteLine("te.int_x={0}\n",te.int_x); Console.WriteLine("te.str_x={0}\n",te.str_x); Console.WriteLine("te.byte_x={0}\n",te.byte_x); }
相关文章推荐
- c# base和this在构造函数中的应用
- .Net C#语法 构造函数中this和base
- C# 语法练习(11): 类[三] - 构造函数、析构函数、base、this
- c#语法糖代码——继承中构造函数的问题,this&base比较
- 【C#】C#构造函数中:base和:this的区别
- c#学习-base和this在构造函数中的应用
- c# base和this在构造函数中的应用
- .NET/C# 类构造函数中this的用法
- C#中this在构造函数时的使用
- c#中构造函数中this的用法
- c#之this显示调用构造函数
- .Net C#语法 构造函数中this和base
- C# this调用构造函数及析构函数
- .Net C#语法 构造函数中this和base
- .NET/C# 类构造函数中this的用法 (转)
- C++ VS C#(10):构造函数与析构函数
- 构造函数,This、final、static关键字的初步认识
- C#温故而知新学习系列之面向对象编程—构造函数(七)
- C#中this的用法
- C#继承/this/base/new