单项选择题

一个类的友元函数或友元类可以通过成员操作符访问该类的( )。

A.私有成员
B.保护成员
C.公有成员
D.所有成员
<上一题 目录 下一题>
热门 试题

单项选择题
有以下程序: #include <iostream> using namespace std; class A private: int x,y; public: void set (int i,int j) x=i; y=j; int get_y() return y; ; class box private: int length,width; A label; public: void set(int 1,int w, int s,int p) length=1; width=w; label.set(s,p); int get_area() return length*width; ; int main() box small; small.set(2,4,1,35); cout<<small.get_area()<<end1; return 0; 运行后的输出结果是( )。
A.8
B.4
C.35
D.70
单项选择题
以下程序执行结果是 ( )。 #include <iostream.h> class Base public virtual void fun() cout<< B ; ; class Derived public: Derived() cout<< D ; virtual void fun() Base::fun(); cout<< C ; int main () Base *ptr; Derived obj; ptr=&obj; p->fun ( ); return 0;
A.DBC
B.DCB
C.BDC
D.CBD
相关试题
  • 有以下程序: #include <iostream> u...
  • 对下列程序的描述中,正确的是( )。 #...
  • 有以下程序: #include <iostream> u...
  • 有如下程序: #include <iostream> u...
  • 有如下程序: #include <iostream> u...