2013-08-23から1日間の記事一覧

構造体のコンストラクタでも引数付けられる

CPP

クラスとの違いがあんまないんだなぁ。 サンプル #include <iostream.h> struct Complex { Complex( int nRe=0, int nIm=0 ) { m_nRe = nRe; m_nIm = nIm; } int m_nRe; int m_nIm; }; void main() { Complex C0; Complex C1( 123 ); Complex C2( 123, 456 ); cout << "C</iostream.h>…