Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions HelloStudents/HelloStudents.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>HelloStudents.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -46,6 +49,11 @@
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Student3099Ham.cs" />
<Compile Include="Student3115Lee.cs" />
<Compile Include="Student3108Kim.cs" />
<Compile Include="Student3103Kim.cs" />
<Compile Include="Student3116JO.cs" />
<Compile Include="Student3199Ham.cs" />
<Compile Include="StudentBase.cs" />
</ItemGroup>
<ItemGroup>
Expand Down
49 changes: 45 additions & 4 deletions HelloStudents/Program.cs
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -13,7 +15,7 @@ static void Main(string[] args)
List<StudentBase> students = new List<StudentBase>();

/*
* 1. Student3099Ham.cs 같은 클래스를 생성 후 Hello 메서드를 자신의 스타일로 수정해보세요.
* 1. StudentBase를 상속받은 Student3099Ham.cs 같은 클래스를 생성 후 Hello 메서드를 자신의 스타일로 수정해보세요.
* 2. Program.cs의 Main 메서드에 자신의 학번 위치에 1.에서 생성한 클래스의
* 객체를 생성해서 추가하는 코드를 넣으세요.
*/
Expand All @@ -24,21 +26,60 @@ 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
// 3112
// 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
Expand Down
12 changes: 12 additions & 0 deletions HelloStudents/Student3103Kim.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace HelloStudents
{


class Student3103Kim : StudentBase
{
public override string Hello()
{
return "안녕하세요? 저는 " + this + "입니다!";
}
}
}
17 changes: 17 additions & 0 deletions HelloStudents/Student3108Kim.cs
Original file line number Diff line number Diff line change
@@ -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() + "이야!";
}
}
}
16 changes: 16 additions & 0 deletions HelloStudents/Student3115Lee.cs
Original file line number Diff line number Diff line change
@@ -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()과 같다.
}
}
}
10 changes: 10 additions & 0 deletions HelloStudents/Student3116JO.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace HelloStudents
{
internal class Student3116JO : StudentBase
{
public override string Hello()
{
return "안녕? 나는 " + this + "야.";
}
}
}
17 changes: 17 additions & 0 deletions HelloStudents/Student3199Ham.cs
Original file line number Diff line number Diff line change
@@ -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 + "님이셔라!";
}
}
}
2 changes: 1 addition & 1 deletion HelloStudents/StudentBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace HelloStudents
abstract class StudentBase : IEquatable<StudentBase>, IComparable<StudentBase>
{
// 속성들 (멤버변수와 다름!)
public string LastName { get; set; }
public string LastName { get; set; } //getter, setter 메서드 생성
public string FirstName { get; set; }
public int StudentNumber { get; set; }

Expand Down