我正在尝试为学生和教师创建一个社交网络应用程序。我目前正在设计用户帐户模块
我想到了这两种方法
方法一
Public class Account
{
public string AccountId{get;set;}
public string AccountName{get;set;}
.
.
.
}
public class Student : Account
{
public Course[] Courses {get; set;}
//other student properties
.
.
.
}
public class Teacher : Account
{
//other teacher properties
}
方法二
Public class Account
{
public string AccountId{get;set;}
public string AccountName{get;set;}
public AccountType AccountType {get;set;} //AccontType is enum having student and teacher
.
.
.
}
public class User
{
public string UserId { get;set;}
public string UserName {get;set;}
public Account Account {get;set;}
}
public class Student : User
{
public Course[] Courses {get; set;}
//other student properties
.
.
.
}
public class Teacher : User
{
//other teacher properties
}
有没有比这些方法更好的方法?