Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是初学者,我制作了一个树形树,我制作了一个类类型和指向这个的指针class,当我使用“this关键字”指向下一个出现的元素时
class
this
编译器错误:“表达式必须具有指向类的类型”
this->right->search_el(k,p);
这意味着你申请operator ->的是非指针类型。你可能想要:
operator ->
this->right.search_el(k,p);
由于this是指针,right因此似乎是唯一不是指针的候选者。在 C++ 中,您可以通过.是否有实例或->是否有指向实例的指针来访问类的成员。
right
.
->