class1.cs

来自「提供了大量初学CSharp的示例」· CS 代码 · 共 46 行

CS
46
字号
using System;

namespace MultiInherit
{
	interface IVi
	{
		void Read();
	}

	abstract class Document
	{
		public  void Write(String str)
		{
			Console.WriteLine("Write Document:{0}", str);
		}
	}

	class Note:Document,IVi
	{
		public void Read()
		{
			Console.WriteLine("Read Note");
		}
		public void Write(string msg)
		{
			Console.WriteLine("Write message into Note {0}", msg);
		}
	}

	class MultiTest
	{
		static void Main()
		{
			IVi note = new Note();
			note.Read();
			Note theNote = (Note)note;
			theNote.Write("This is a test");

			Note doc = new Note();
			doc.Write("Document");
			Document doc1 = doc as Document;
			doc1.Write("After change");
		}
	}
}

⌨️ 快捷键说明

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