有如下类定义: class Pass{ static int count; public: Pass(){} void show()const; friend in

admin2021-05-06  24

问题 有如下类定义:
     class Pass{
         static int count;
     public:
         Pass(){}
         void show()const;
         friend int getCount();
         static int incre();
     };
在所声明的4个函数中,具有this指针的有

选项 A、Pass和show
B、Pass和show
C、show和incre
D、getCount和incre

答案A

解析 C++的类定义中,只有非静态成员函数具有this指针,Pass类中getCount()函数是友元函数,不属于成员函数,没有this指针,选项B、D错误;incre()函数是静态成员函数,没有this指针,选项C错误;答案为A。
转载请注明原文地址:https://jikaoti.com/ti/Jnh0FFFM
0

最新回复(0)