ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 2020-04-14 [Class 선언 및 인스턴스, 변수선언/리턴의 이해]
    C#/수업내용 2020. 4. 14. 14:22
    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
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
     
    namespace Study_009
    {
        class APP
        {
            public APP()
            {
                SCV scv = new SCV();
     
                Barracks brracks = scv.BuildBarracks();
     
                scv.BuildAcademy();
     
                Bunker bunker = scv.BuildBunker();
     
                Marine marine= brracks.CreateMarine();
     
                bunker.EnterBunker(marine);
                bunker.ExitBunker(marine);
     
            }
        }
    }
     
    ===========================================================================
        class Barracks
        {
            public Barracks()
            {
                Console.WriteLine("배럭을 생성했습니다.");
            }
     
            public Marine CreateMarine()
            {
                return new Marine();
            }
        }
    }
    ===========================================================================
        class Academy
        {
            public Academy()
            {
                Console.WriteLine("아카데미 생성됨");
            }
        }
    }
    ===========================================================================
     
        class Bunker
        {
            public Bunker()
            {
                Console.WriteLine("벙커 생성");
               
            }
            
            public void EnterBunker(Marine marine)
            {
                Console.WriteLine("마린이 벙커에 들어왔습니다.");
                marine.HideDisplay();
            }
     
            public void ExitBunker(Marine marine)
            {
                Console.WriteLine("마린이 벙커에서 나갔습니다.");
                marine.ShowDisplay();
            }
        }
    }
     
     
    ===========================================================================
        class Marine
        {
            public Marine()
            {
                Console.WriteLine("마린생성");
            }
     
            public void ShowDisplay()
            {
                Console.WriteLine("마린이 보입니다");
            }
     
            public void HideDisplay()
            {
                Console.WriteLine("마린이 안보입니당");
            }
        }
    }
    ===========================================================================
     
        class SCV
        {
            public SCV()
            {
               Console.WriteLine("SCV가 생성됨");
            }
     
            public Barracks BuildBarracks()
            {
                return new Barracks();
           
            }
            
            public void BuildAcademy()
            {
                new Academy();
            }
     
            public Bunker BuildBunker()
            {
               return new Bunker();
            }
        }
     
     
    http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter

     

     

    'C# > 수업내용' 카테고리의 다른 글

    2020-04-17 [1차원배열 ]  (0) 2020.04.17
    2020-04-16 [1차원배열 활용]  (0) 2020.04.16
    2020-04-13  (0) 2020.04.13
    2020-04-09 [작성 및 활용 ]  (0) 2020.04.09
    2020-04-08 _003  (0) 2020.04.08
Designed by Tistory.