C++?中的抽象類其實就是純虛函數組成的類,如下所示:
class?SpreadsheetCell
{
public:
????SpreadsheetCell();
????virtual?~SpreadsheetCell();
????virtual?void?set(const?std::string&?inString)?=?0;
????virtual?std::string?getString()?const?=?0;
};An abstract class provides a way to prevent other code from instantiating an object directly, as opposed to one of its subclasses.
抽象類只能被擴展,不能創建一個與他某個子類相沖突的對象實例!
---------------------------------------------------------
專注移動開發
Android, Windows Mobile, iPhone, J2ME, BlackBerry, Symbian
posted on 2007-02-12 16:40
TiGERTiAN 閱讀(168)
評論(0) 編輯 收藏