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

📄 implementinterface.cs

📁 vc的原码例子12 vc的原码例子12
💻 CS
字号:
using System;
using System.Collections;

interface Book
{
	void ShowBook();
	string GetTitle();
	int GetPages();
	void SetPages(int pages);
}

class NewBook: Book
{
	public string title;
	public int pages;
	public string author;

	public NewBook(string title, string author, int pages)
	{
		this.title = title;
        this.pages = pages;
		this.author = author;
	}

	public string GetTitle()
	{
		return(title);
	}

	public int GetPages()
	{
		return(pages);
	}

	public void SetPages(int pages)
	{
		this.pages = pages;
	}

	public void ShowBook()
	{
		Console.WriteLine("Title: {0}", title);
		Console.WriteLine("Author: {0}", author);
		Console.WriteLine("Pages: {0}", pages);
	}
}

public class ImplementInterface  
{
	public static void Main()  
	{
			NewBook MyNovel = new NewBook("American Dream", "Smith", 600);
		MyNovel.ShowBook();
	}
}

⌨️ 快捷键说明

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