Class Empolyee Private m_salary AsInteger 'Empolyee员工类有Salary薪水属性 PublicProperty Salary()AsInteger '薪水介于20000~40000之间 Get Return m_salary EndGet Set(ByVal value AsInteger) If value < 20000 Then m_salary = 20000 ElseIf value > 40000 Then m_salary = 40000 Else m_salary = value EndIf EndSet EndProperty EndClass
Class Manger 'Manger经理类继承自Empolyee员工类? Inherits Empolyee Public Bonus AsInteger '加入Bonus奖金字段? PublicSub ShowTotal() '加入显示实领奖金方法 Console.WriteLine("实领薪水:{0}", Bonus + Salary) EndSub EndClass