using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
class bell
{
public delegate void RingDelegate();
public event RingDelegate RingEvent;
public void Ring()
{
if (RingEvent != null)
{
RingEvent();
}
}
}
class Student
{
public Student(bell bella)
{
bella.RingEvent += new bell.RingDelegate(Run);
}
public void Run()
{
MessageBox.Show("老¤?师º|、¡é学¡ì生¦¨² 进?教¨¬室º¨°准Á?备À?上¦?课?");
}
}
private void button1_Click(object sender, EventArgs e)
{
bell bella = new bell();
Student m = new Student(bella);
bella.Ring();
}