using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication10
{
    class Program
    {
        public static void Main()
        {
            Contact c1 = new Contact();
            c1.m_name = "Li Ming";
            c1.m_age = 20;
            c1.m_telephone = "86-10-60010800";
            Colleague c2 = new Colleague();
            c2.m_Fax = "86-10-60010801";
            TelDelegate td = new TelDelegate(c1.DailNumber);
            td();
            FaxDelegate fd = new FaxDelegate(c2.SendFax);
            fd("Hello");
            fd = new FaxDelegate(c2.ReceiveFax);
            fd("This is a fax From Shangha.");
        }
    }
    delegate void TelDelegate();
    delegate void FaxDelegate(string Text);
    interface ITelephone
    {
        void DialNumber();
    }
    interface IFax : ITelephone
    {
        void SendFax(string text);
        void ReceiveFax(string text);
    }
    class Contact : ITelephone
    {
        public string m_name;
        public int m_age;
        public string m_telephone = "Unkown";
        public void DailNumber()
        {
            Console.WriteLine("Starting Dialing...");
            Console.WriteLine(m_telephone);
            Console.WriteLine("Connected.");
            Console.Write("Press Enter Key To End:");
            Console.ReadLine();
            Console.WriteLine("Disconnected");
        }
    }
    class Colleague : Contact, IFax
    {
        public string m_Fax;
        public void SendFax(string text)
        {
            Console.WriteLine("Starting Dialing...");
            Console.WriteLine(m_Fax);
            Console.WriteLine("Connected.");
            Console.Write("Send:");
            Console.WriteLine(text);
            Console.WriteLine("Diasconnected.");        }
        public void ReceiveFax(string text)
        {
            Console.WriteLine("Starting Dialing...");
            Console.WriteLine(m_Fax);
            Console.WriteLine("Connected.");
            Console.Write("Send:");
            Console.WriteLine(text);
            Console.WriteLine("Disconnected.");
        }
    }
}