📄 multipleinterfaces.cs
字号:
using System;
using System.Collections;
interface Person
{
void ShowName();
void ShowPhone();
void ShowAddress();
}
interface Office
{
void ShowOffice();
void ShowOfficePhone();
}
class Employee: Person, Office
{
private string Name;
private string Phone;
private string Address;
private string OfficeNumber;
private string OfficePhone;
public Employee(string name, string phone, string address,
string officenumber, string officephone)
{
this.Name = name;
this.Phone = phone;
this.Address = address;
this.OfficeNumber = officenumber;
this.OfficePhone = officephone;
}
public void ShowName()
{
Console.WriteLine("Name: {0}", Name);
}
public void ShowPhone()
{
Console.WriteLine("Phone: {0}", Phone);
}
public void ShowAddress()
{
Console.WriteLine("Address: {0}", Address);
}
public void ShowOffice()
{
Console.WriteLine("Office: {0}", OfficeNumber);
}
public void ShowOfficePhone()
{
Console.WriteLine("Office Phone: {0}", OfficePhone);
}
public void ShowEmployee()
{
ShowName();
ShowPhone();
ShowAddress();
ShowOffice();
ShowOfficePhone();
}
}
public class MultipleInterfaces
{
public static void Main()
{
Employee Worker = new Employee("Jones", "555-1212", "123 Main Street",
"3A", "555-1213");
Worker.ShowEmployee();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -