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

如果在物件裡...ㄉ.

0 views
Skip to first unread message

.......

unread,
Jul 1, 2001, 10:41:51 PM7/1/01
to
※ 引述《CIA...@bbs.mhit.edu.tw (CIA)》之銘言:
> example:
> class go
> {
> private:
> static int i; 靜態成原變數
> public:
> void show()
> {
> cout<<go::i; 這行輸出有錯嗎??
> }
> };
> 可是編意器會出縣錯誤...why???可是我在書上說可以...??
範例就長這樣嗎?
會出現什麼錯勿訊息呢?
--
※ Origin: 楓橋驛站<bbs.cs.nthu.edu.tw> ◆ From: yale130132045020.student.yale.edu

夢想‧爵士‧貓

unread,
Jul 2, 2001, 1:28:36 PM7/2/01
to
==> 在 CIA...@bbs.mhit.edu.tw (CIA) 的文章中提到:

> example:
> class go
> {
> private:
> static int i; 靜態成原變數
^^^^^^^^^^^^
Static data member needs to be instantiated!

> public:
> void show()
> {
> cout<<go::i; 這行輸出有錯嗎??
> }
> };

int go::i; // Instantiate static data member.

> void main()
> {
> go lin;
> lin.show();
> }
> 可是編意器會出縣錯誤...why???可是我在書上說可以...??

Error message 應該有跟你說為什麼錯吧?
--
* Origin: ★ 交通大學資訊科學系 BBS ★ <bbs.cis.nctu.edu.tw: 140.113.23.3>

0 new messages