2020 - LargeSettlement

From TRCCompSci - AQA Computer Science
Revision as of 12:16, 27 January 2020 by Admin (talk | contribs)
Jump to: navigation, search

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.