⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class1.cs

📁 C#2005 实例源代码
💻 CS
字号:
using System;

namespace Example_ref
{
	/// <summary>
	/// 学生类
	/// </summary>
	public class Student
	{
		public string strName;	//姓名
		public int nAge;		//年龄
		

		/// <summary>
		/// 构造函数
		/// </summary>
		public Student(string _strName,int _nAge)
		{
			this.strName=_strName;
			this.nAge=_nAge;
		}

		/// <summary>
		/// 长大_nSpan岁
		/// </summary>
		public void Grow(int _nSpan,ref int _nOutCurrentAge)
		{
			this.nAge+=_nSpan;
			_nOutCurrentAge=this.nAge;
		}
	}

	/// <summary>
	/// Class1 的摘要说明。
	/// </summary>
	class Class1
	{
		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{
			Student s=new Student("张三",20);
			int nCurrentAge=0;
			s.Grow(3,ref nCurrentAge);
			Console.WriteLine(s.nAge);	//输出23
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -