简单的一个类的存储空间

限于喜欢 提交于 2019-11-29 00:15:53
/*
对于此类的模型为:
class object
{
    float _x;//类的nonstatic成员函数
    _vptr_Point;//指向虚函数表的指针
}

virtual table//虚函数表的信息(应该存放的是一些指针)
slot1---type info for Point(用于支持RTTI)
slot2---~Point()
slot3---print()

类之外
//成员函数
Point::Point(float)
float x() const

//static函数
static int PointCount()
//static数据成员
static int _point_count
*/
#include <iostream>
class Point    
{
public:
    Point(float xval);
    virtual ~Point();

    float x() const;
    static int PointCount();

protected:
    virtual std::ostream& print(std::ostream& os) const;

    float _x;
    static int _point_count;
};

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!