填空题

非成员函数应该声明为类______函数才能访问该类的私有成员。

【参考答案】

友元
<上一题 目录 下一题>
热门 试题

填空题
有如下程序: #include<iostream> using namespace std; class Monitor public: Monitor(char t):type(t) void Print( )const cout<< The type of monitor is <<type char type; ; class Computer public: Computer(int i,char C) :______ void Print( )const eout<< The computer is <<id<<endl;mort.Print( ); private: int id; Monitor mon; ; int main( ) const Computer myComputer(101,’B’); myComputer.Print( ); return 0; 请将程序补充完整,使程序在运行时输出: The computer is 101 The type of monitor is B
填空题
下面的函数利用递归实现了求1+2+3+…+n的功能: int sum(int n) if(n==0)return 0; else return n+saln(n-1); 在执行SUm(10)的过程中,递归调用sum函数的次数是______。
相关试题
  • 补充完整下面的模板定义: template<clas...
  • 补充完整下面的类定义: const double P...
  • 补充完整下面的类定义: class XCH char...
  • 有如下程序: #include<iostream> usi...