类方法中的类地址 [英] address of class from within class method
问题描述
有没有办法从一个
类的方法中获取指向类的指针?
pe *********** *****@hotmail.com 写道:有没有办法从一个
类的方法中获取指向类的指针? / blockquote>
每个班级都可以通过this来引用自己。指针。在你最喜欢的
最喜欢的C ++书中查阅。
干杯! --M
pe **************** @ hotmail.com 写道:有没有办法从里面获取一个类的指针
类的方法之一?
指向类的指针是什么意思?一个类不是一个对象,
它是一个类型。您可以使用
关键字this获取指向当前对象的指针。
mlimber写道:pe **************** @ hotmail.com 写道:有没有办法从一个
类的方法中获取一个类的指针?
每个班级都可以通过这个来引用自己。指针。在你最喜欢的C ++书中查找。
不,每个*对象*都可以通过this引用自己。指针。一个类是
不是一个对象,因此没有一个地址,指针
可以指向。
Is there a way to get a pointer to a class from inside one of the
class''s methods?
解决方案pe****************@hotmail.com wrote:Is there a way to get a pointer to a class from inside one of the
class''s methods?
Every class can refer to itself by a "this" pointer. Look it up in your
favorite C++ book.
Cheers! --M
pe****************@hotmail.com wrote:Is there a way to get a pointer to a class from inside one of the
class''s methods?
What do you mean by a "pointer to a class"? A class is not an object,
it is a type. You can get a pointer to the current object by using the
keyword "this".
mlimber wrote:pe****************@hotmail.com wrote:Is there a way to get a pointer to a class from inside one of the
class''s methods?
Every class can refer to itself by a "this" pointer. Look it up in your
favorite C++ book.
No, every *object* can refer to itself by a "this" pointer. A class is
not an object, and therefore doesn''t have an address, which a pointer
can point to.
这篇关于类方法中的类地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!