Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

C++ "this" 一問

0 views
Skip to first unread message

netking

unread,
Dec 14, 1997, 3:00:00 AM12/14/97
to

I dont know
--
[mΞ Origin: 逢甲蒼穹資訊網 <bbs.fcu.edu.tw> [FROM: i5.pc-m.fcu.edu]

大 師

unread,
Dec 14, 1997, 3:00:00 AM12/14/97
to

==> 在 netki...@gopher.fcu.edu.tw (netking) 的文章中提到:
: I dont know

this 代表這個物件之位址
parent 則代表父輩之位址

小弟

unread,
Dec 15, 1997, 3:00:00 AM12/15/97
to

==> 在 wiske...@csie.nctu.edu.tw (大 師) 的文章中提到:
^^^^^^^^^^^^^^^^^^^^^^
標準的C++好像沒有這個吧,
this是在物件中指向自己的指標,為const T*形
態,也只有物件內部才看得到唷。
可以參閱"The C++ programming",有一節在敘述
this的用法。

--
My E-Mail : r552...@ms.cc.ntu.edu.tw

===================================

Shuoh from NTU Che
--
* Origin: ★ 交通大學資訊科學系 BBS ★ <bbs.cis.nctu.edu.tw: 140.113.23.3>

PTI

unread,
Dec 15, 1997, 3:00:00 AM12/15/97
to

==> shuo...@cis.nctu.edu.tw (小弟) 提到:
: ==> 在 wiske...@csie.nctu.edu.tw (大 師) 的文章中提到:
: > this 代表這個物件之位址

: > parent 則代表父輩之位址
: ^^^^^^^^^^^^^^^^^^^^^^
: 標準的C++好像沒有這個吧,
: this是在物件中指向自己的指標,為const T*形
: 態,也只有物件內部才看得到唷。
: 可以參閱"The C++ programming",有一節在敘述
: this的用法。
:

成員函數中所看到的 this 指標,其型態不會是 const T* !

大部分的情況之下,this 的型態應該是 T *const。如果該成員函數被
宣告為 const 的,則 this 的型態應該是 const T *const;同樣的,如
果該成員函數被宣告為 volatile,則 this 的型態應該是 volatile T * const。

請注意區分「const T *」與「T *const」二者的區別.


--
◎ [1;31m龍 [32m貓 [33m資 [34m訊 [35m天 [36m地 [0m( [1mbbs.mgt.ncu.edu.tw [0m)
◎[ [1;33;46mpti [0m]來自: 203.69.3.3

0 new messages