[問題] 簡單錯誤卻找不到@@|

看板C_and_CPP作者 (喵~>"<||)時間14年前 (2010/05/12 00:57), 編輯推噓2(207)
留言9則, 6人參與, 最新討論串1/1
=====================已解決,感謝=================== 以下C++ 大家好,我有一個簡單的問題卻一直抓不到BUG在哪,勞煩各位幫忙, 這是描述.H的函式 #include<iostream> #include<string> #include "Account.h" Account::Account(string name) { //一直抓不到這行的BUG setAccount(name); } void Account::setAccount(string name) { nameofAccount =name; } string Account::getAccount() { return nameofAccount; } ----------------------------------------------- 以下.H #include <iostream> #include <string> using namespace std; class Account { public: Account(string); string getAccount(); void setAccount(string); void setMoney(int,int); int getMoney(); private: int getm; int initial; int money; string nameofAccount; } 他一直出現 new types may not be defined in a return type return type specification for constructor invalid 在我有標記bug那行 麻煩各位高手了 感謝 ※ 編輯: a77d4e06 來自: 218.35.19.53 (05/12 00:58)

05/12 00:59, , 1F
srting??
05/12 00:59, 1F
※ 編輯: a77d4e06 來自: 218.35.19.53 (05/12 01:00)

05/12 01:00, , 2F
好像不是耶>"<
05/12 01:00, 2F

05/12 01:01, , 3F
class尾,分號??
05/12 01:01, 3F

05/12 01:01, , 4F
class{}後的 ; 有記得加嗎??
05/12 01:01, 4F

05/12 01:01, , 5F
被b大搶先了XDDD
05/12 01:01, 5F

05/12 01:02, , 6F
為蝦米CLASS後面要分號@@?
05/12 01:02, 6F
※ 編輯: a77d4e06 來自: 218.35.19.53 (05/12 01:03)

05/12 01:07, , 7F
有的就只是語法上的規定而已, 沒有為什麼 ~"~
05/12 01:07, 7F

05/12 01:32, , 8F
相較於函式括弧,個人認為分號結尾在型態宣告上相當一致
05/12 01:32, 8F

05/12 12:55, , 9F
C++ class 宣告語法是承繼 C struct 來的
05/12 12:55, 9F
文章代碼(AID): #1BwOo6sq (C_and_CPP)