📄 11-1.cs
字号:
//程序11-1
using System;
interface IDistributable
{
void Distribute();
}
interface ISalable
{
void Sale();
}
public class Print
{
protected int num;
protected double prc;
public Print(){}
public Print(int n, double p)
{
num=n;
prc=p;
}
public void Publish ()
{
Console.WriteLine("Number: {0}, Price: ¥{1} ",num,prc);
}
}
public class LectureNotes :Print, IDistributable, ISalable
{
protected string Name;
public LectureNotes(){}
public LectureNotes(string nm,int n, double p):base(n,p)
{
Name = nm;
//在基类构造函数中完成:
// num=n; prc=p;
}
public void Notes(){Console.WriteLine("The LectureNotes is "+Name);}
public void Distribute(){Console.WriteLine("Distributed in campus only.");}
public void Sale(){Console.WriteLine("Sale on cost.");}
}
public class Test
{
public static void Main()
{
LectureNotes LN = new LectureNotes("C# Programming", 400, 28.6);
LN.Notes();
LN.Distribute();
LN.Sale();
LN.Publish();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -