this指针能看对象的地址,那怎么上机调试具体操做步骤

来源:百度知道 编辑:UC知道 时间:2024/05/18 01:07:40
#include<iostream.h>
class Point//创建点类
{
int X,Y,Z;
public:
Point(int x=0,int y=0,int z=0)//构造函数
{X=x;Y=y;Z=z;}
int showX() { return X;}//显示坐标函数
int showY() {return Y;}
int showZ() {return Z;}
};
void main()
{Point p1(4,5,6),p2(7,8,9),p3(10,11,12);//生成三个点对象
cout<<"p1"<<"("<<p1.showX()<<","<<p1.showY()<<","<<p1.showZ()<<")"<<endl;//输出三个点坐标
cout<<"p2"<<"("<<p2.showX()<<","<<p2.showY()<<","<<p2.showZ()<<")"<<endl;
cout<<"p3"<<"("<<p3.showX()<<","<<p3.showY()<<","<<p3.showZ()<<")"<<endl;
}
想通过vc++6.0上机调试看到对象p1,p2,p3的地址?具体操作步骤??

如果是VC的话,在
cout<<"p3"<<"("<<p3.showX()<<","<<p3.showY()<<","<<p3.showZ()<<")"<<endl;
一行定个断点,在debug模式启动,断下,在左下角的调试窗口
“自动”“局部”窗口就可以看到p1 等变量,当然地址也可以看到

如果看不到这些窗口,通过调试 -》窗口 菜单打开