下列程序段中包含4个函数。其中具有隐含this指针的是( )。 int fun1(); class Test{ public: int fun2(); friend int fun3(): static

admin2019-06-04  29

问题 下列程序段中包含4个函数。其中具有隐含this指针的是(    )。
    int fun1();
    class Test{
    public:
    int fun2();
    friend int fun3():
    static int fun4();
}

选项 A、fun1
B、fun2
C、fun3
D、fun4

答案B

解析 this指针是成员函数所属对象的指针,它指向类对象的地址。成员函数通过这个指针知道自己属于哪一个对象。this指针是一个隐含的指针,它隐含于每个类的非静态成员函数中,它明确的地表示出了成员函数当前操作的数据所属的对象。
转载请注明原文地址:https://kaotiyun.com/show/in8p777K
0

最新回复(0)