首页 > 开发 > 综合 > 正文

My Bridge in C#

2024-07-21 02:19:13
字体:
来源:转载
供稿:网友
国内最大的酷站演示中心!
//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


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表