揮発性のメモ2

http://d.hatena.ne.jp/iww/

2016-07-04から1日間の記事一覧

コンストラクタの中から仮想関数は呼べない

C++

#include <iostream> using namespace std; class hoge { public: int a; hoge(){ cout << "hoge" << endl; init(); } virtual void init(){ a = 123; } }; class piyo: public hoge { public: /* piyo(){ cout << "hoge" << endl; init(); } */ virtual void init(){ </iostream>…