//MyBridge
using System;
//-------------------------------------------------Class Manager
//parent class
abstract class Manager
{
??? //Method:KickOut
?abstract public void KickOut();
};
//sonclass1:FemaleManager
class FemaleManager:Manager
{
?override public void KickOut()
?{
??Console.WriteLine("Please Go Out!");
?}
};
//sonclass2:MaleManager
class MaleManager:Manager
{
?override public void KickOut()
?{
??Console.WriteLine("Out!Shit!");
?}
};
//-------------------------------------------------Class Manager
//-------------------------------------------------Class ChatRoom
class ChatRoom
{
?//manager to keep the room silent:Field
?private Manager chatroommanager;
?//property
?public Manager ChatRoomManager
?{
??set{ chatroommanager=value; }
?}
?//Method
??? public void KickOut()
?{
??chatroommanager.KickOut();
?}
};
//-------------------------------------------------Class ChatRoom
//-------------------------------------------------TestApp
class TestApp
{
?public static void Main(string []args)
?{
??ChatRoom chatroom = new ChatRoom();
??
??chatroom.ChatRoomManager=new FemaleManager();
??chatroom.KickOut();
??chatroom.ChatRoomManager=new MaleManager();
??chatroom.KickOut();
??while(true);
?}
};
//-------------------------------------------------TestApp