diff --git a/HelloStudents/HelloStudents.csproj b/HelloStudents/HelloStudents.csproj
index 401c607..23de553 100644
--- a/HelloStudents/HelloStudents.csproj
+++ b/HelloStudents/HelloStudents.csproj
@@ -32,6 +32,9 @@
prompt
4
+
+ HelloStudents.Program
+
@@ -46,6 +49,11 @@
+
+
+
+
+
diff --git a/HelloStudents/Program.cs b/HelloStudents/Program.cs
index d813670..2e676e4 100644
--- a/HelloStudents/Program.cs
+++ b/HelloStudents/Program.cs
@@ -1,9 +1,11 @@
-using System;
+// using은 java의 import 같은 역할
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using System.Threading.Tasks;
+using System.Threading.Tasks; //import
+// namespace는 java의 패키지 같은 역할
namespace HelloStudents
{
class Program
@@ -13,7 +15,7 @@ static void Main(string[] args)
List students = new List();
/*
- * 1. Student3099Ham.cs 같은 클래스를 생성 후 Hello 메서드를 자신의 스타일로 수정해보세요.
+ * 1. StudentBase를 상속받은 Student3099Ham.cs 같은 클래스를 생성 후 Hello 메서드를 자신의 스타일로 수정해보세요.
* 2. Program.cs의 Main 메서드에 자신의 학번 위치에 1.에서 생성한 클래스의
* 객체를 생성해서 추가하는 코드를 넣으세요.
*/
@@ -24,14 +26,38 @@ static void Main(string[] args)
FirstName = "기훈", LastName = "함",
StudentNumber = 3099, BaseYear = 2020
});
+ students.Add(
+ new Student3199Ham()
+ {
+ FirstName = "Gihun",
+ LastName = "Ham",
+ StudentNumber = 3199,
+ BaseYear = 2021
+ });
// 3101
// 3102
// 3103
+ students.Add(
+ new Student3103Kim()
+ {
+ FirstName = "나은",
+ LastName = "김",
+ StudentNumber = 3103,
+ BaseYear = 2020
+ });
// 3104
- // 3105
+ // 3105
// 3106
// 3107
// 3108
+ students.Add(
+ new Student3108Kim()
+ {
+ FirstName = "지영",
+ LastName = "김",
+ StudentNumber = 3108,
+ BaseYear = 2021
+ });
// 3109
// 3110
// 3111
@@ -39,6 +65,21 @@ static void Main(string[] args)
// 3113
// 3114
// 3115
+ students.Add(
+ new Student3115Lee()
+ {
+ FirstName = "지민",
+ LastName = "이",
+ StudentNumber = 3115,
+ BaseYear = 2021
+ });
+ // 3116
+ students.Add(
+ new Student3116JO()
+ {
+ FirstName = "서영", LastName = "조",
+ StudentNumber = 3116, BaseYear = 2020
+ });
// 3117
// 3118
// 3119
diff --git a/HelloStudents/Student3103Kim.cs b/HelloStudents/Student3103Kim.cs
new file mode 100644
index 0000000..b12c63c
--- /dev/null
+++ b/HelloStudents/Student3103Kim.cs
@@ -0,0 +1,12 @@
+namespace HelloStudents
+{
+
+
+ class Student3103Kim : StudentBase
+ {
+ public override string Hello()
+ {
+ return "안녕하세요? 저는 " + this + "입니다!";
+ }
+ }
+}
diff --git a/HelloStudents/Student3108Kim.cs b/HelloStudents/Student3108Kim.cs
new file mode 100644
index 0000000..63c0686
--- /dev/null
+++ b/HelloStudents/Student3108Kim.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HelloStudents
+{
+ class Student3108Kim : StudentBase
+ {
+ public override string Hello()
+ {
+ return "안녕? 나는 " + this + "이야!";
+ // return "안녕? 나는 " + this.ToString() + "이야!";
+ }
+ }
+}
diff --git a/HelloStudents/Student3115Lee.cs b/HelloStudents/Student3115Lee.cs
new file mode 100644
index 0000000..6b26c00
--- /dev/null
+++ b/HelloStudents/Student3115Lee.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HelloStudents
+{
+ class Student3115Lee : StudentBase
+ {
+ public override string Hello()
+ {
+ return "안녕? 나는 " + this + "이야~~~~~~~~~~~~~~!"; //this는 this.ToString()과 같다.
+ }
+ }
+}
diff --git a/HelloStudents/Student3116JO.cs b/HelloStudents/Student3116JO.cs
new file mode 100644
index 0000000..83c4add
--- /dev/null
+++ b/HelloStudents/Student3116JO.cs
@@ -0,0 +1,10 @@
+namespace HelloStudents
+{
+ internal class Student3116JO : StudentBase
+ {
+ public override string Hello()
+ {
+ return "안녕? 나는 " + this + "야.";
+ }
+ }
+}
\ No newline at end of file
diff --git a/HelloStudents/Student3199Ham.cs b/HelloStudents/Student3199Ham.cs
new file mode 100644
index 0000000..006f537
--- /dev/null
+++ b/HelloStudents/Student3199Ham.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HelloStudents
+{
+
+ class Student3199Ham : StudentBase
+ {
+ public override string Hello()
+ {
+ return "안녕? 나는 " + this + "님이셔라!";
+ }
+ }
+}
diff --git a/HelloStudents/StudentBase.cs b/HelloStudents/StudentBase.cs
index c592409..c70e0bb 100644
--- a/HelloStudents/StudentBase.cs
+++ b/HelloStudents/StudentBase.cs
@@ -9,7 +9,7 @@ namespace HelloStudents
abstract class StudentBase : IEquatable, IComparable
{
// 속성들 (멤버변수와 다름!)
- public string LastName { get; set; }
+ public string LastName { get; set; } //getter, setter 메서드 생성
public string FirstName { get; set; }
public int StudentNumber { get; set; }