디자인 모드 관 후 (c + 복원 20 외관 모드)

1160 단어 살다
//    
//       ,                 
//    :  ——      、  、  、  、
//    
class ILetterProcess {
public:
	virtual void WriteContext(string context) = 0;
	virtual void FillEnvelope(string address)= 0 ;
	virtual void LetterInotoEnvelope() = 0;
	virtual void SendLetter() = 0;
};
//     
class LetterProcessImpl : public ILetterProcess {
public:
	void WriteContext(string context) {
		cout << "    :" << context << endl;
	}
	void FillEnvelope( string address) {
		cout << "        :" << address << endl;
	}
	void LetterInotoEnvelope() {
		cout << "      " << endl;
	}
	void SendLetter() {
		cout <WriteContext(context);
		m_pLetter->FillEnvelope(address);
		m_pPolice->CheckLetter(m_pLetter);
		m_pLetter->LetterInotoEnvelope();
		m_pLetter->SendLetter();
	}
};
class Client {
public:
	static void main() {
		ModenPostOffice* p_ModePost = new ModenPostOffice;
		p_ModePost->SendLetter("Happy Today", "give me");
	}
};
//                     
int _tmain(int argc, _TCHAR* argv[])
{
	Client::main();
	system("pause");
	return 0;
}

좋은 웹페이지 즐겨찾기