我在实现文件中有以下内容......
void ClientList::interestCompare(vector<string> intr)
{
for(int index = 0; index < intr.size(); index++)
{
this->interests[index];
}
}
这在规范文件中......
class ClientList
{
private:
// A structure for the list
struct ListNode
{
char gender;
string name;
string phone;
int numInterests; // The number of interests for the client
vector<string> interests; // list of interests
string match;
struct ListNode *next; // To point to the next node
};
//more stuff
...}
是否可以使用“this”指针访问结构中的“interests”向量?
如果有怎么办。
正如我现在所拥有的,我初始化一个 ListNode 指针指向 head 以便访问列表。我只是想知道“this”指针是否只能访问类的成员,或者它们是否可以访问嵌入在类中的更深层次的 ADT 变量。
这个问题还有意义吗?