比较来自世界各地的卖家的域名和 IT 服务价格

调用来自同一类的另一个成员函数的成员函数 C++, objective C

考虑以下:


class A{

//data members

void foo//
{
bar//;//is this possible? or should you say this->bar// note that bar is not static
}
void bar//
{

}
}//end of class A


您如何从另一个内部调用成员函数? 以及静态功能如何影响使用 'this'.
应该要求对象?
已邀请:

龙天

赞同来自:

纳瓦斯粉尘: 'this' 会员。 唯一的例外 - 如果 foo 是一个静态功能,因为没有静态功能 'this'. 在这种情况下,您无法使用 bar//, 要是 bar// 也不是静态功能,你根本无法使用 this->bar//.

风见雨下

赞同来自:

bar//;//is this possible? or should you say this->bar//



this

会员。 所以两者都是等同的。 你可以使用它们中的任何一个。 但是我认为如果足够
bar//

, 然后为什么要使用
this->bar//

?

使用
this

只有在有某种模糊性时,否则使用更简单!

要回复问题请先登录注册