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

admin2015-07-22  18

问题 有如下类定义:
     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://kaotiyun.com/show/kMNp777K
0

最新回复(0)