且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C ++中Classname * obj和classname obj之间的区别

更新时间:2022-06-10 05:46:14



类名obj;

obj是类classname的对象,而在(classname * obj)中,obj是指向类classname的对象的指针.

您可以参考这篇文章以了解更多信息.

http://msdn.microsoft.com/en-us/library/e1t5f7bs.aspx

[ ^ ]
Hi,

classname obj;

obj is and object of class classname, Where as in (classname* obj) obj is pointer to an object of class classname.

You can refer this article to know more.

http://msdn.microsoft.com/en-us/library/e1t5f7bs.aspx

[^]


您似乎不知道什么是指针,因此,我真诚地怀疑任何在线论坛都对您有用.

请阅读有关C的好书.一旦您了解了基础知识,在线论坛将对您有很大的帮助.
You don''t seem to know what is a pointer, so I sincerely doubt any of the online forums are going to be useful to you.

Please read a good book on C. Once you understand the basics, online forums will be of great help to you.


classname object;
classname* pointer_object;
object.member_function();
pointer_object->member_function();
pointer_object[0].member_function();
pointer_object[10].member_function(); // if pointer_object is an array of classname