Иллюстрированный самоучитель по VB.NET


Практический пример: динамический список с поддержкой сериализации - часть 3


Sub RaiseSa1ary(ByVal Percent As Decimal._

ByVal Password As String) If Password = "special" Then

m_Salary = (1 + Percent) * m_Salary

End If

End Sub

End Class

<Serializable()>Public Class Manager

Inherits Employee

Private m_Sec As Secretary

Private m_Salary As Decimal

Public Sub New(ByVal sName As String,_

ByVal curSalary As Decimal)

MyBase.New(sName. curSalary)

End Sub

Public Sub New(ByVal sName As String.ByVal curSalary As Decimal.

ByVal mySec As Secretary)

MyBase.New(sName.curSalary)

m_Sec = mySec

End Sub

Property MySecretary()As Secretary Get

Return m_Sec End Get Set(ByVal Value As Secretary)

m_Sec = Value

End Set

End Property

Public Overloads Overrides

Sub RaiseSalary(ByVal percent As Decimal)

MyBase.RaiseSalary(2 * percent, "special")

End Sub

End Class

<Serializable()>

Public Class Secretary Inherits Employee

Private m_Boss As Manager

Public Sub New(ByVal sName As String. ByVal curSalary As Decimal,

ByVal myBoss As Manager) MyBase.New(sName, curSalary)

m_Boss = myBoss

End Sub

Property MyManager() As Manager Get

Return m_Boss

End Get Set(ByVal Value As Manager)

m_Boss = Value

End Set

End Property

End Class




- Начало -  - Назад -  - Вперед -



Книжный магазин