下面程序的输出结果是 #include class example {int a; public: example(int b) {a=
18 查阅
下面程序的输出结果是
#include<iostream.h>
class example
{
int a;
public:
example(int b) {a=b++;}
void pnnt( ) {a=a+1;cout < < a < <" ";}
void print( ) const{cout < < a < <" ";}
};
void main( )
{
example x(3) ;
const example y(2) ;
x.print( ) ;
y.print( ) ;
}
A.2 2
B.4 3
C.4 2
D.3 2
参考答案: