以下程序的输出?
null
<br> #include < iostream ><br> using namespace std;<br> class Point {<br> Point() { cout << "Constructor called" ; }<br> };<br><br> int main()<br> {<br> Point t1;<br> return 0;<br> }<br> |
(A) 编译错误 (B) 运行时错误 (C) 构造函数调用 (D) 这些都不是 答复: (A) 说明: 默认情况下,类的所有成员都是私有的。由于Point()没有访问说明符,因此它成为私有的,在main中构造t1时在类外部调用它。 这个问题的小测验
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END