oo-70-245-1

oo-70-245-1 Commit Details


Date:2014-09-15 18:35:43 (10 years 1 month ago)
Author:Natalie Adams
Branch:master
Commit:0f165c23cd6a03b0f7319dc9f8c1d529496299c4
Parents: 39c97eb444e0a5c7dd9b5b5d5e0bd1a2684d7e17
Message:Adding example 13

Changes:

File differences

Day 3 Class Examples/example13/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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace example13
{
abstract class Position
{
public abstract string Title { get; }
}
class Manager : Position
{
public override string Title
{
get { return "Manager"; }
}
}
class Clerk : Position
{
public override string Title
{
get { return "Clerk"; }
}
}
class Programmer : Position
{
public override string Title
{
get { return "Programmer"; }
}
}
static class Factory
{
public static Position Get(int id)
{
switch (id)
{
case 0:
return new Manager();
case 1:
return new Clerk();
default:
return new Programmer();
}
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Position id = {0}, position = {1}", 0, Factory.Get(0));
}
}
}

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.08095s using 14 queries.