随笔-348  评论-598  文章-0  trackbacks-0
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 阅读(162) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: