Files
  • main.cs
  • main.exe
  • person.cs
  • programmer.cs
main.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// We are "using" the System library
using System;
using Examples;

// Namespace Examples
namespace Examples {
// Our class is "MainClass"
  class MainClass {
    // Public: Available outside the class
    // Static: It doesn't change
    // Void: It does not return a value
    //
    // string[] args: the arguments sent to the program as an array of string values
    public static void Main (string[] args) {

      // Create a new Person object
      // Set the initial values of:
      // "Demo" for 'name'
      // "1234" for 'ID'
      Person Demo = new Person("Demo", "1234");

      // Write a single line to the console.
      // Use the public methods of Person
      // Use name to return '_name'
      // use id to return '_ID'
      Console.WriteLine (
        Demo.name + " " + Demo.ID
      );

      // Create a new Programmer object
      // Set the initial values of:
      // "Demo2" for 'name'
      // "5678" for 'ID'
      // "Knows C#!" for 'skills'
      Programmer Demo2 = new Programmer("Demo2", "5678", "Knows C#!");

      // Write a single line to the console.
      // Use the public methods of Programmer
      // Use name to return '_name'
      // Use id to return '_ID'
      // Use skills to return '_skills'
      Console.WriteLine (
        Demo2.name + " " + Demo2.ID + " " + Demo2.skills
      );

    }
  }
}
Mono C# compiler version 4.0.4.0