word完美格式
int x; };
void main() {
Myclass my(10);
Cout< 11、 完成下面的类定义。 Class MyClass {  public:  MyClass(){x=0;}  ____friend______int GetNum(___MyClass ______my); private: int x;  };  int GetNum(____MyClass ______my) {  ___return my.x;  }   12、 __new__运算符对指定类型对象动态分配内存并返回该类型的__指针__。   13、 若要把函数void FriendFunction()定义为类MyClass的友元函数,则应在类MyClass的定义中加入语句__friend void FriendFunction();_______。  14、 类的具体表现是通过定义_对象__来操作的。   15、 在定义类的对象时,C++程序将自动调用该对象的__构造___函数初始化对象自身。  16、 一般情况下,按照面向对象的要求,把类中的数据成员(属性)定义为__private__权限,而把成员函数(方法)定义为__public__权限。  17、 在类中定义和实现的函数称为_内联函数__。   18、 非成员函数应声明为类的__友元函数__才能访问这个类的private成员。   2.3简答题  A、类的含义  B、构造函数的特点 C、拷贝构造函数的调用 D、析构函数的定义及其特点 E、静态成员的分类及各自的特点  2.4程序阅读题  1) 写出下列程序的运行结果。 #include                         精心整理   学习帮手  word完美格式  {   char ch; public:   MyClass();   MyClass(char character);  void Print();  ~MyClass(); };  MyClass::MyClass() {   cout<<\ ch='a'; }  MyClass::MyClass(char character) {   cout<<\ ch=character; }  void MyClass::Print() {   cout<<\}  MyClass::~MyClass() {   cout<<\}  void main() {   MyClass first,second('b');  first.Print();  second.Print(); }  运行结果:  This is a constructor! This is a constructor! The value of ch is a The value of ch is b This is a destructor! This is a destructor!     2)写出下列程序的运行结果 #include                         精心整理   学习帮手  word完美格式  class MyClass {  public: MyClass(); void Print(); ~MyClass(); private: int I;  static int j;  };  int MyClass::j=0; MyClass::MyClass() {  cout<<\j+=10;  }  void MyClass::Print()  {  cout<<\ }  MyClass::~MyClass() {  cout<<\ }  void main()  {  MyClass first,second; first.Print(); second.Print();  }   This is constructor! This is constructor! The value of j is20 The value of j is20 This is a destructor! This is a destructor!                           精心整理   学习帮手  word完美格式  继承与派生  3.1选择题  .在C++中,类与类之间的继承关系具有(  C  ) A)自反性    B)对称性    C)传递性    D)反对称性  .在公有继承的情况下,基类的成员(私有的除外)在派生类中的访问权限(A)受限制    B)保持不变    C)受保护    D)不受保护  .按解释中的要求在下列程序划线处填入的正确语句是:(  C  ) #include  void fun(){cout<<\;} };  class Derived:public Base{ public:  void fun()  {              //在此空格处调用基类的函数fun() cout<<\;} };  A)fun();    B)Base.fun();    C)Base::fun();    D)Base->fun();  .在保护继承的情况下,基类的成员(私有的除外)在派生类中的访问权限(A)受限制    B)保持不变    C)受保护    D)不受保护  .下面描述中,表达错误的是:(  B  )  A)公有继承时,基类中的public成员在派生类中仍是public的 B)公有继承时,基类中的private成员在派生类中仍是private的 C)公有继承时,基类中的protected成员在派生类中仍是protected的 D)私有继承时,基类中的public成员在派生类中是private的 .下列虚基类的声明中,正确的是:(  B  )                         精心整理   学习帮手  ))  B      C