19.03.26 과제

개임개발/과제 2019. 3. 27. 00:46
728x90
반응형

2019_03_27_00_18_46

2019_03_27_00_31_49

 

다음 코드를 보고 읽고 쓰세요 (음성파일로 대체 가능) x 20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Study_03
{
    class Program
    {
        static void Main(string[] args)
        {
            new App();
 
            Console.ReadKey();
        }
    }
}
 
cs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Study_03
{
    class App
    {
        //생성자 
        public App()
        {
            var character = new Character("홍길동");
            Console.WriteLine("케릭터의 이름 : {0}", character.name);
            character.Move(1.2f, 3.5f);
        }
    }
}
 
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Study_03
{
    class Character
    {
        public string name; 
 
        //매개변수 1개 있는 생성자
        public Character(string name)
        {
            this.name = name;
        }
 
        //기능 (이동)
        public void Move(float x, float y)
        {
            Console.WriteLine("{0}이 ({1},{2})로 이동했습니다."this.name, x, y);
 
        }
    }
}
 
cs




728x90
반응형

'개임개발 > 과제' 카테고리의 다른 글

19.03.27 static  (0) 2019.03.28
19.03.26 상수,열거형식, var 타입 등  (0) 2019.03.27
19.03.25 값 복사와 참조 복사  (0) 2019.03.25
19.03.22 오우거 잡기  (0) 2019.03.24
19.03.22 Stack 과 Heap  (0) 2019.03.24
: