欧美日韩艺术电影在线|霹雳娇娃在线观看完整版免费高清|国产精品电影在线观看|黄色你懂的,边做饭边被躁我和邻居日本 ,南方恶魔未删减版,91欧美在线

軟題庫(kù) 學(xué)習(xí)課程
當(dāng)前位置:信管網(wǎng) >> 在線考試中心 >> 試題查看
試題題型【分析簡(jiǎn)答題】
試題內(nèi)容

閱讀下列說(shuō)明和 C++代碼,填補(bǔ)代碼中的空缺,將解答填入答題紙的對(duì)應(yīng)欄內(nèi)。
【說(shuō)明】
以下 C++代碼實(shí)現(xiàn)一個(gè)簡(jiǎn)單客戶關(guān)系管理系統(tǒng)(CrM)中通過(guò)工廠(Customerfactory)對(duì)象來(lái)創(chuàng)建客戶(Customer)對(duì)象的功能。客戶分為創(chuàng)建成功的客戶(realCustomer)和空客戶(NullCustomer)??湛蛻魧?duì)象是當(dāng)不滿足特定條件時(shí)創(chuàng)建或獲取的對(duì)象。類(lèi)間關(guān)系如圖6-1 所示。

【C++代碼】
#include
#include
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〞<coutcoutcoutcoutdelete 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
*/

查看答案

相關(guān)試題



更多試題