Re: [問題] this 指標
看板C_and_CPP (C/C++)作者feeya (24 August 升格為鄉民)時間16年前 (2009/06/06 22:45)推噓0(0推 0噓 0→)留言0則, 0人參與討論串2/2 (看更多)
class 可以當成structure使用
所以 cubic cubic_sum(cubic object)
意思跟 int int_sun(int value) 是一樣的
至於this就很簡單了
a是cubic所宣告的變數
this->a就是a變數
沒有this->不加也可以用
this->等於(*this).
所以說this就是此物件的指標
以上是憑經驗打的
有錯誤請指正
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.42.121.131
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):
2
2
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章