找考题网-背景图
未分类题

下面程序的结果为 #include<iostream.h> int c; class A { private: int a; static int b; public: A( ) {a=0;c=0;} void seta( ){a++;} void setb( ){b++;}
A.1 2 1
B.1 2 2
C.1 1 2
D.2 2 2

A.h>
B.1
C.1
D.1
E.2

【参考答案】

B
解析:C++语言中全局变量是任何函数都可以改变的量,静态变量的有效范围在定义它的类中,而普通的变量的有效性只在使用它的函数中,在本题中c为全局变量,b为静态变量,a为普通变量,b和c在类A的对象a1和a2中都自加1。所以b,c为 2,a为1。
热门试题

未分类题You are the administrator of a Windows NT Server 4.0 computer named Ezonexam1. Ezonexam1 is a backup domain controller (BDC), and a member of Ezonexam.com's Windows 2000 Active Directory domain. Ezonexam1 contains five hard disks. Disk 0 and 1 are configured as a Windows NT 4.0 mirror set.The mirror set contains the operating system files and 500 MB of free disk spacE.Disk 2, 3 and 4 are configured as a Windows NT 4.0 stripe set with parity and contain employee data files. The Windows NT 4.0 stripe set with parity has a maximum capacity of 140 GB and contains 15 GB of free disk spacE.Ezonexam1 runs an application that is used by 400 company employees. A new version of the application is availablE.You need to install the new version, but it requires Windows 2000 Server. Also, the application will not run on a domain controller.You need to install the new application on Ezonexam1 as quickly as possiblE.What should you do first?A.On Ezonexam1, back up the employee data files. Then format all five disks and perform. a clean installation of Windows 2000 Server. Restore the employee data files.B.On Ezonexam1, install Windows 2000 Server. Configure Ezonexam1 to use a dual-boot configuration that includes Windows NT Server 4.0 and Windows 2000 Server.C.Upgrade Ezonexam1 to Windows 2000 Server. During the upgrade, select the option to make Ezonexam1 a member server.D.Upgrade Ezonexam1 to Windows 2000 Server. During the upgrade, select the option to make Ezonexam1 a domain controller. After the upgrade is complete, demote Ezonexam1.

A.0
B.com's
C.0
D.
The
E.0
F.0
G.
Ezonexam1
H.
You
I.On
J.
B.On
K.0
L.
C.Upgrade
M.
D.Upgrade