jeans chen
we've got them by the balls
#include <iostream>
#include <stdlib.h>

using namespace std;
class Foo
{
public:
int i;
float f;
char *cp;

};

int main()
{
Foo f1;
if(f1.cp == 0) cout <<" in stack,f1.cp is null "<< endl;
cout<< f1.i << " " << f1.f <<" "<<f1.cp << endl;


Foo *pf = new Foo();
if(pf->cp == 0) cout <<" in heap,pf.cp is null "<< endl;
cout << pf->i << " " << pf->f << " "<< pf->cp <<endl;

return 0;
}

 /work/ctest/insideTheC++ObjectModel$ ./1
770374040 4.55997e-41 H�l$�L�d$�H�-
 in heap,pf.cp is null
0 0

posted on 2013-12-02 16:10  jeans chen  阅读(165)  评论(0编辑  收藏  举报