高等继续教育 / 面向对象程序设计
正确率:推荐%
题型描述: 简答题
写出下面程序的执行结果:
#include<iostream>
using namespace std;
class A{
private:
int a,b;
public :
A( );
A(int i,int j);
void print ( );
};
A::A( )
{ a=b=0; cout<<"Default constructor is called.
"; }
A::A(int i,int j)
{ a=i; b=j; cout<<"Constructor is called.
"; }
void A::print ( )
{ cout<<"a="<<a<<","<<"b="<<b<<endl; }
int main( )
{ A m,n(4,8);
m.print ( );
n.print ( );
return 0;}
参考答案:
佳题速递: