Difference between revisions of "2022 - Program"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Created page with "=The Code= <syntaxhighlight lang=c#> class Program { static void Main(string[] args) { Breakthrough ThisGame = new Breakthrough();...")
 
(Explanation)
 
Line 16: Line 16:
 
By default, when a C# program is run this will be the code to be executed first (ie the 'static void Main' in the class of program).
 
By default, when a C# program is run this will be the code to be executed first (ie the 'static void Main' in the class of program).
  
This creates a new instance of 'Breakthrough' called 'ThisGame.
+
This creates a new instance of 'Breakthrough' called 'ThisGame'.
  
 
The 'PlayGame' method of object 'ThisGame' is then called.
 
The 'PlayGame' method of object 'ThisGame' is then called.

Latest revision as of 08:25, 1 September 2021

The Code

    class Program
    {
        static void Main(string[] args)
        {
            Breakthrough ThisGame = new Breakthrough();
            ThisGame.PlayGame();
            Console.ReadLine();
        }
    }

Explanation

By default, when a C# program is run this will be the code to be executed first (ie the 'static void Main' in the class of program).

This creates a new instance of 'Breakthrough' called 'ThisGame'.

The 'PlayGame' method of object 'ThisGame' is then called.