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

📄 class1.cs

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

namespace Example_AttributeOverload
{
	/// <summary>
	/// 学生类
	/// </summary>
	public class Student
	{
		private string strName;		//域
		public	string Name		//属性
		{
			get{return this.strName;}
			set{this.strName=value;}
		}
	}

	/// <summary>
	/// 大学生类 继承:学生类
	/// </summary>
	public class CollegeStudent : Student
	{
		private string strName;		//域
		public string Name			//属性
		{
			get{return this.strName;}
			set{if(value!="")	this.strName=value;}	
		}
	}

	/// <summary>
	/// Class1 的摘要说明。
	/// </summary>
	class Class1
	{
		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{
			CollegeStudent cs=new CollegeStudent();
			cs.Name="张三";
			Console.WriteLine(cs.Name);

		}
	}
}

⌨️ 快捷键说明

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