C++相談室 part87
■ このスレッドは過去ログ倉庫に格納されています
0062デフォルトの名無しさん
2010/12/12(日) 15:22:52class Super {
protected:
const std::string& m_str;
void write() const {
std::cout << m_str << std::endl;
}
public:
Super(const std::string& s) : m_str(s) {};
};
class Sub : public Super {
public:
Sub() : Super(std::string("string")) {};
void write() const {
Super::write();
}
};
int main()
{
Sub* s = new Sub;
s->write();
delete s;
}
■ このスレッドは過去ログ倉庫に格納されています