2008年(46)
分类: C/C++
2008-11-11 21:59:58
class CCustomer
{
public:
string m_name;
CCustomer(string & s_name)
{
m_name = s_name;
}
} ;
class CBank
{
public:
bool SufficentSavings(CCustomer & c)
{
cout << "check customer:" << c.m_name << "'s sufficentsaving."<<endl;
return true;
}
};
class CCredit
{
public:
bool checkCredit(CCustomer & c)
{
cout << "check customer:" << c.m_name << "'s Credit."<<endl;
return true;
}
};
class CLoan
{
public:
bool checkLoan(CCustomer & c)
{
cout << "check customer:" << c.m_name << "'s Loan."<<endl;
return true;
}
};
class CFacadeMortgage
{
public:
bool debit(string& s)
{
m_pcust = new CCustomer(s);
m_pbank = new CBank();
if (!m_pbank->SufficentSavings(*m_pcust))
return false;
m_ploan = new CLoan();
if (!m_ploan->checkLoan(*m_pcust))
return false;
m_pcredit = new CCredit();
if (! m_pcredit->checkCredit(*m_pcust))
return false;
return true;
}
private:
CBank* m_pbank;
CCustomer* m_pcust;
CLoan* m_ploan;
CCredit* m_pcredit;
} ;
int main(int argc, char* argv[])
{
CFacadeMortgage d;
d.debit("ss");
getch();
return 0;
}