資源簡介
C++實戰源碼-祖先的止癢藥方(入門級實例208).zip
代碼片段和文件信息
//?Ancestor.cpp?:?Defines?the?entry?point?for?the?console?application.
//
#include?“stdafx.h“
#include?“iostream.h“
class?Ancestor?{
private:
char*?prescription;//定義藥方
public:
Ancestor(){prescription?=?“吃中藥“;}
protected:
char*?getPrescription()?{//獲得藥方
????????return?prescription;
????}
};
class?Child?:public?Ancestor?{
public:
void?Out()?{
????????cout?<“獲得祖先的止癢藥方:“?<????????cout?<ription()?<????}
};
int?main(int?argc?char*?argv[])
{
Child?ch;
ch.Out();
return?0;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????577??2010-10-13?19:33??Ancestor\Ancestor.cpp
?????文件????????4560??2010-10-13?19:27??Ancestor\Ancestor.dsp
?????文件?????????541??2010-10-13?19:27??Ancestor\Ancestor.dsw
?????文件?????????295??2010-10-13?19:27??Ancestor\StdAfx.cpp
?????文件?????????769??2010-10-13?19:27??Ancestor\StdAfx.h
評論
共有 條評論