Now my question is: how can I do this when I create a new type of Trip object, will arrayOfPeople be the size of the numberOfRooms value?
class Trip
{
private Person[] arrayOfPeople;
public Person[] arrayOfPeople get { return arrayOfPeople; }
set { arrayOfPeople = value; }
}
class Ship
{
private int numberOfRooms;
public int NumberOfRooms
{
get { return numberOfRooms; }
set { numberOfRooms = value; }
}
}
I was thinking about making numOfRooms static, and then in the Trip constructor just set arrayOfPeople = new Person [Ship.NumberOfRooms], but I'm not sure if this is aproach right. Feel free to correct me if I am wrong.
source
share