using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DisplayRealize
{
public interface Istudentplayable
{
void Play();
}
public interface IBoyFriendable
{
void Play();
}
public class Student : Istudentplayable, IBoyFriendable
{
//显示接口主要为了防止方法名重名的时候,做到更加明细是哪个接口
void Istudentplayable.Play()
{
Console.WriteLine("陪同学玩游戏!");
}
void IBoyFriendable.Play()
{
Console.WriteLine("陪女朋友看电影!");
}
}
class Program
{
static void Main(string[] args)
{
Student stu = new Student();
Istudentplayable stuplay = stu;
stuplay.Play();
IBoyFriendable boyplay = stu;
boyplay.Play();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DisplayRealize
{
public interface Istudentplayable
{
void Play();
}
public interface IBoyFriendable
{
void Play();
}
public class Student : Istudentplayable, IBoyFriendable
{
//显示接口主要为了防止方法名重名的时候,做到更加明细是哪个接口
void Istudentplayable.Play()
{
Console.WriteLine("陪同学玩游戏!");
}
void IBoyFriendable.Play()
{
Console.WriteLine("陪女朋友看电影!");
}
}
class Program
{
static void Main(string[] args)
{
Student stu = new Student();
Istudentplayable stuplay = stu;
stuplay.Play();
IBoyFriendable boyplay = stu;
boyplay.Play();
}
}
}