class1.cs

来自「C#开发教程 由浅入深 配有实例 是初学者的好帮手」· CS 代码 · 共 38 行

CS
38
字号
using System;

namespace OverloadInherit
{
	class Log
	{
		public Log(string fileName) {}
		public Log() {}

		public void WriteEntry(string entry)
		{
			Console.WriteLine(entry);
		}
	}

	class LogEx : Log
	{
		public LogEx(string fileName) {}

		public void WriteEntry(int resourceId)
		{
			Console.WriteLine(
				"Retrieve resource id and write to log");
		}
	}

	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
			LogEx log = new LogEx("My File");
			log.WriteEntry("Entry one");
			log.WriteEntry(42);
		}
	}
}

⌨️ 快捷键说明

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