我有一套代碼,它模仿了一個基本的圖書館編目系統。有一個名爲items的基類,其中定義了一般的id,title和year變量以及3個其他派生類(DVD,Book和CD)。幫助解決這些警告。 [繼承]
基地[項目]
衍生[DVD,書籍,CD。
程序運行,但我得到以下警告,我不知道如何解決這些問題。
>"C:\Program Files\gcc\bin/g++" -Os -mconsole -g -Wall -Wshadow -fno-common mainA4.cpp -o mainA4.exe In file included from mainA4.cpp:5: a4.h: In constructor `DVD::DVD(int, std::string, int, std::string)': a4.h:28: warning: `DVD::director' will be initialized after a4.h:32: warning: base `Items' a4.h:32: warning: when initialized here a4.h: In constructor `Book::Book(int, std::string, int, std::string, int)': a4.h:48: warning: `Book::numPages' will be initialized after a4.h:52: warning: base `Items' a4.h:52: warning: when initialized here a4.h: In constructor `CD::CD(int, std::string, int, std::string, int)': a4.h:66: warning: `CD::numSongs' will be initialized after a4.h:70: warning: base `Items' a4.h:70: warning: when initialized here >Exit code: 0
非常感謝你 – silent 2010-05-02 05:05:41
很好的答案,謝謝。 – 2013-04-10 05:58:27