// 客户端 int main_bridge2() { HandsetBrand *brand; brand = new HandsetBrandM(); brand->SetHandsetSoft(new HandsetGame()); brand->Run(); brand->SetHandsetSoft(new HandSetAddressList()); brand->Run(); return 0; }
int test_Bridge1() { HandsetBrand* brand; brand = new HandsetBrandM(); brand->SetHandsetSoft(new HandsetGame()); brand->Run(); brand->SetHandsetSoft(new HandSetAddressList()); brand->Run(); /* result: 运行手机游戏 手机通讯录 */ return 0; }
int main() { HandsetBrand *hb = new HandsetBrandM(); hb->setHandsetSoft(new HandsetGame()); hb->run(); hb->setHandsetSoft(new HandsetAddressList()); hb->run(); hb->setHandsetSoft(new HandsetQQ()); hb->run(); ptr=runs; ptr(hb); cin.get(); return 0; }