■
実装をちょい変更。
実は、社員番号そのものが、結構な制約条件がついたりするけど。
Option Explicit On Option Strict On Public Class 社員 Private _社員番号 As String Public Sub New() _社員番号 = 社員番号生成() End Sub Public Sub New(ByVal 社員番号 As String) _社員番号 = 社員番号 End Sub Private _苗字 As String Public Property 苗字() As String Get Return _苗字 End Get Set(ByVal value As String) _苗字 = value End Set End Property Private _名前 As String Public Property 名前() As String Get Return _名前 End Get Set(ByVal value As String) _名前 = value End Set End Property Public Function 社員番号生成() As String Dim 返り値 As String = "" 'ここで、DBアクセスとかして社員番号を取得してみる Return 返り値 End Function Public Function 役職取得() As List(Of 役職) Dim 戻り値 As List(Of 役職) = New List(Of 役職) Return 戻り値 End Function End Class Public Class 役職 Public Sub New() End Sub Private _役職CD As String Public Property 役職CD() As String Get Return _役職CD End Get Set(ByVal value As String) _役職CD = value End Set End Property Private _役職名 As String Public Property 役職名() As String Get Return _役職名 End Get Set(ByVal value As String) _役職名 = value End Set End Property Private _所属部署 As String Public Property 所属部署() As String Get Return _所属部署 End Get Set(ByVal value As String) _所属部署 = value End Set End Property End Class