learning C++ 对象模型 of 关于对象

  有两个概念可以解释C++对象模型:

  1、语言中直接支持面向对象程序设计的部分

  2、对于各种支持的底层实现机制

 

  在C++中,有两种class data members:static 和nonstatic,以及三种class member functions: static、nonstatic和virtual。

      比如下面这个Point类:

 1 class Point
 2 {
 3  public:      
 4        Point(float xval);
 5        virtual  ~Point();
 6        
 7        float x() const; 
 8        static int PointCount();
 9 protected:
10        virtual ostream& print (ostream &os) const;
11        
12        float _x;
13        static int _point_count;
14 }

   那么这个类在机器中是怎样表现的呢?

第一种模型  简单对象模型

 

 

 

 

 

 

 

 

 

 

 

 

 

 

posted @ 2012-08-11 23:59  王耀it  阅读(166)  评论(0编辑  收藏  举报