无效和这个 [英] void and this

查看:46
本文介绍了无效和这个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我有一个类成员函数声明为


class some_class {

.. ..

虚拟int调用(无效);

};


我可以使用这个 - >在函数体内?

谢谢。


弗拉基米尔

解决方案

弗拉基米尔Grul写道:

你好,

我有一个类成员函数声明为

类some_class {
...
virtual int call(void);


放弃空白。 C ++不是C.


虚拟int调用(void);



virtual int call();

的意思完全相同

};

我可以使用这个 - >在函数体内?




是的。


-

Attila aka WW


>我有一个类成员函数声明为


类some_class {
...
virtual int call(void);


空参数列表中的void在C ++中被认为是坏样式。

};

我可以使用这个 - >在函数体内?




当然,是什么让你认为你不能?

Jonathan


" Jonathan Mcdougall" <乔*************** @ DELyahoo.ca>写道:


当然,是什么让你认为你不能?




我不确定参数列表中是否有隐含的内容。


谢谢你和阿提拉。


弗拉基米尔


Hello,

I have a class member function declared as

class some_class {
....
virtual int call(void);
};

Can I use this-> inside the function body?
Thanks.

Vladimir

解决方案

Vladimir Grul wrote:

Hello,

I have a class member function declared as

class some_class {
...
virtual int call(void);
Drop the void. C++ is not C.

virtual int call(void);
and
virtual int call();
mean exactly the same
};

Can I use this-> inside the function body?



Yes.

--
Attila aka WW


> I have a class member function declared as


class some_class {
...
virtual int call(void);
void in an empty parameter list is considered bad style in C++.
};

Can I use this-> inside the function body?



Of course, what makes you think you can''t?
Jonathan


"Jonathan Mcdougall" <jo***************@DELyahoo.ca> writes:


Of course, what makes you think you can''t?



I was not sure if there is an implicit this in parameter list.

Thank you and Attila.

Vladimir


这篇关于无效和这个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆