单选题
有如下类定义: class Bag{ public: Bag(string s,string cr); //① ~Bag(); //② string GetSize(); //③ static int GetCount(); //④ private: string size,color; static int count; };在标注号码的4个函数中,不具有隐含this指针的是
【正确答案】
D
【答案解析】解析:当在类的非静态成员函数中访问类的非静态成员的时候,编译器会自动将对象本身的地址作为一个隐含参数传递给函数,所以①②③正确使用this指针。而④为静态成员,没有this指针,答案为D选项。