// ( x1.C ) // コンストラクトとインライン実装の注意 // #include // コンストラクトの実装をインラインで行う // 時は、for 文は使っていけないみたい。 class Print { public: Print() ; // これはOK void show() { for ( int i=0;i<3;i++ ) cout << i << endl ; } } ; Print::Print() { for ( int i=0;i<3;i++ ) cout << i << endl ; } /* こっちのコンストラクタはコンパイル・エラ−がでる。 CC: not implemented: cannot expand inline function Print2::Print() with for statement in inline class Print2 { public: Print2() { for ( int i=0;i<2;i++ ) cout << i << endl ; } } ; */ main() { Print *v = new Print ; v->show() ; delete v ; }