0

以下のコードはクラスのコンストラクターであり、このクラスにはメンバーがあります

int               ** busyhours      ;

コンストラクター

Instructor::Instructor ( int id , string name )
{
  this->id   = id   ;
  this->name = name ;

  // initialize busyhours
  this->busyhours = new int * [DAYS_WORKING] ;
  for ( int i = 0 ; i < DAYS_WORKING ; i++ )
  {
       busyhours[i] = new int[HOURS_PER_DAY] ;
       for ( int j = 0 ; j < HOURS_PER_DAY ; j++ )
        busyhours[i][j] = 0 ;
  }
}

ビジーアワー メンバーは、最初にこのポインターで使用されましたが、その後、このポインターなしで使用されました。理由がわかりません。回答ありがとうございます。

4

3 に答える 3

5

this暗黙的であり、パラメーターがメンバー変数と同じ名前を持つ場合にのみ必要です

于 2012-10-19T17:47:41.633 に答える