首页 > 试题广场 >

阅读下列程序,写出运行结果: #include

[问答题]
阅读下列程序,写出运行结果:
#include<iostream>
using namespace std;
class T
{
public:
T(int x) { a=x; b+=x; };
static void display(T c) { cout<<"a="<<c.a<<'\t'<<"b="<<c.b<<endl; }
private:
int a;
static  int  b;
};
int T::b=5;
int main()
{
T A(3), B(5);
T::display(A);
T::display(B);
}

推荐

a=3      b=13

a=5     b=13

编辑于 2018-05-07 15:08:02 回复(0)