-4 c++ inheritance
我有一个有#include iostream的班级啊
然后在Bh我#include啊
然后在Ch我#include Bh
在C.cpp中,我将print()函数定义为
void C::print() const {
cout << "C has specs of: " << getSpecs() << endl;
}
Run Code Online (Sandbox Code Playgroud)
对于C.cpp,cout是不确定的为什么会这样?
我认为,因为iostream被包含在Ah中,因为Bh包括Ah和Ch包括Bh,所以它将包括iostream用于我的C.cpp
无论如何在没有#including iostream的情况下完成这个我的所有.h's?
我很擅长继承并学习如何运作.