2022 - Program

From TRCCompSci - AQA Computer Science
Revision as of 09:25, 1 September 2021 by Admin (talk | contribs) (Explanation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.