[問題] 如何不要在Header file include header
問題(Question):
假設我想在某類別CB當中宣告類別CA當作class member
而我不想在CB.h當中#include "CA.h",我只要在CB.h當中這樣寫:
1. class CA;
2.
3. class CB
4. {
5. private:
6. CA objA;
7. };
然後在CB.cpp當中這樣
#include "CA.h"
#include "CB.h"
但若我想在CB當中宣告一個vector<int>當作class member
但我又不想在CB.h當中#include<vector>
則在CB.h當中我應該如何宣告?
煩請各位前輩告訴我作法,謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.139.140.233
※ 編輯: tod 來自: 220.139.140.233 (05/20 22:20)
→
05/20 22:33, , 1F
05/20 22:33, 1F
→
05/21 00:02, , 2F
05/21 00:02, 2F
推
05/21 00:07, , 3F
05/21 00:07, 3F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章