-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
35 lines (27 loc) · 1.06 KB
/
Program.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
using System;
using HeroAssembler.Models;
namespace HeroAssembler
{
class Program
{
static void Main(string[] args)
{
// args is an array of strings passed from the console when the program starts
foreach (string arg in args)
{
Console.Write($" {arg}");
}
// passing parameter to constructor
Alliance avengers = new Alliance("Avengers");
Console.WriteLine($"Named Alliance: {avengers.Name}");
//call a methods on the class instance
avengers.Assemble();
// using the object initializer
Alliance namedWithInitializerAlliance = new Alliance() { Name = "Justice League" };
Console.WriteLine($"Initializer Alliance: {namedWithInitializerAlliance.Name}");
//relying on the default name in the overload of the constructor with no params
Alliance unknownAlliance = new Alliance();
Console.WriteLine($"Unknown Alliance: {unknownAlliance.Name}");
}
}
}