Difference between revisions of "2020 - LargeSettlement"
(Created page with "This is just like Creating 2020 - Settlement") |
|||
Line 1: | Line 1: | ||
− | This is | + | This is will inherit 'Settlement' so is a subclass of Settlement. |
+ | |||
+ | The details for Settlement can be found here [[2020 - Settlement]]. | ||
+ | |||
+ | ==Constructor== | ||
+ | The only method defined is a new constructor | ||
+ | <syntaxhighlight lang=csharp> | ||
+ | public LargeSettlement(int extraXSize, int extraYSize, int extraHouseholds) | ||
+ | : base() | ||
+ | { | ||
+ | xSize += extraXSize; | ||
+ | ySize += extraYSize; | ||
+ | startNoOfHouseholds += extraHouseholds; | ||
+ | for (int count = 1; count < extraHouseholds + 1; count++) | ||
+ | { | ||
+ | AddHousehold(); | ||
+ | } | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | The line: | ||
+ | <syntaxhighlight lang=csharp> | ||
+ | public LargeSettlement(int extraXSize, int extraYSize, int extraHouseholds) | ||
+ | : base() | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | will also run the constructor from the 'base' class. |
Revision as of 12:16, 27 January 2020
This is will inherit 'Settlement' so is a subclass of Settlement.
The details for Settlement can be found here 2020 - Settlement.
Constructor
The only method defined is a new constructor
public LargeSettlement(int extraXSize, int extraYSize, int extraHouseholds)
: base()
{
xSize += extraXSize;
ySize += extraYSize;
startNoOfHouseholds += extraHouseholds;
for (int count = 1; count < extraHouseholds + 1; count++)
{
AddHousehold();
}
}
The line:
public LargeSettlement(int extraXSize, int extraYSize, int extraHouseholds)
: base()
will also run the constructor from the 'base' class.