Difference between revisions of "Composition - 2017"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Created page with "Composition is where if you delete the main class the subclasses are deleted along with it, or they no longer work. <syntaxhighlight lang="c#"> class Location { publi...")
(No difference)

Revision as of 15:43, 6 February 2017

Composition is where if you delete the main class the subclasses are deleted along with it, or they no longer work.

  class Location
  {
    public Fox Fox;
    public Warren Warren;

    public Location()
    {
      Fox = null;
      Warren = null;
    }
  }

  class Simulation
  {
    private Location[,] Landscape;
    private int TimePeriod = 0;
    private int WarrenCount = 0;
    private int FoxCount = 0;
    private bool ShowDetail = false;
    private int LandscapeSize;
    private int Variability;
    private static Random Rnd = new Random();