#includeusingnam..."/>

国产精品久久久久久免费免熟,五月婷婷激情综合网,欧美三级视频网站,一级少妇淫片,国产精品女教师av久久,啪啪免费视频,wwww黄色片

軟題庫 移動APP 掃碼下載APP 隨時隨地移動學習 培訓課程
當前位置:信管網 >> 在線考試中心 >> 信息系統項目管理師題庫 >> 試題查看
試卷名稱 2017年上半年程序員考試下午真題試題(案例分析)
考試中心《2017年上半年程序員考試下午真題試題(案例分析)》在線考試
試卷年份2017年上半年
試題題型【分析簡答題】
試題內容

閱讀下列說明和 C++代碼,填補代碼中的空缺,將解答填入答題紙的對應欄內。
【說明】
以下 C++代碼實現一個簡單客戶關系管理系統(CrM)中通過工廠(Customerfactory)對象來創(chuàng)建客戶(Customer)對象的功能??蛻舴譃閯?chuàng)建成功的客戶(realCustomer)和空客戶(NullCustomer)??湛蛻魧ο笫钱敳粷M足特定條件時創(chuàng)建或獲取的對象。類間關系如圖6-1 所示。

【C++代碼】
#include<iostream>
#include<string>
using namespace std;

class Customer{
protected:
string name;
public:
(1) boll isNil()=0;
(2) string getName()=0;
﹜;

class realCustomer (3){
public:
realCustomer(string name){this->name=name;﹜
bool isNil(){ return false;﹜
string getName(){ return name;﹜
﹜;

class NullCustomer (4){
public:
bool isNil(){ return true;﹜
string getName(){ return 〝Not Available in Customer Database〞;﹜
﹜;
class Customerfactory{
public:
string names[3]={〝rob〞, 〝Joe〞,〝Julie〞﹜;
public:
Customer*getCustomer(string name){
for (int i=0;i<3;i++){
if (names[i].(5)){
return new realCustomer(name);


return (6);

﹜;

class CrM{
public:
void getCustomer(){
Customerfactory*(7);
Customer*customer1=cf->getCustomer(〝rob〞);
Customer*customer2=cf->getCustomer(〝Bob〞);
Customer*customer3=cf->getCustomer(〝Julie〞);
Customer*customer4=cf->getCustomer(〝Laura〞);

cout<<〝Customers〞<<endl;
cout<<Customer1->getName()<<endl; delete  customer1;
cout<<Customer2->getName()<<endl; delete customer2;
cout<<Customer3->getName()<<endl; delete  customer3;
cout<<Customer4->getName()<<endl; delete  customer4;
delete cf;

﹜;

int main(){
CrM*crs=new CrM();
crs->getCustomer();
delete crs;
return 0;


/*程序輸出為:
Customers
rob
Not Available in Customer Database
Julie
Not Available in Customer Database
*/


相關試題

推薦文章
合作網站內容