第11章类和对象2010_11课件精品.ppt

第11章类和对象2010_11课件精品

题 3.分析以下程序的输出结果 #includeiostream.h class Sample { int x; public: Sample(int a) { x=a; coutconstructing object:x=xendl; } }; void func(int n) { static Sample obj(n); } void main() { func(1); func(10); } 题 4 分析以下程序的执行结果 #includeiostream.h class Sample { int x,y; public: Sample(){x=y=0;} Sample(int a,int b){x=a;y=b;} void disp() { coutx=x,y=yendl; } }; void main() { Sample s(2,3), *p=s; p-disp(); } 题 5 分析以下程序的执行结果 #includeiostream.h class Sample { public: int x; int y; void disp() { coutx=x,y=yendl; } }; ? void main() { int Sample::*pc; S

文档评论(0)

1亿VIP精品文档

相关文档