Composition - 2017

From TRCCompSci - AQA Computer Science
Revision as of 14:43, 6 February 2017 by Ilostmylastaccount (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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();