//Visual Basic 2010 Redefinition - Overridable en Overrides Object Oriented Programming public class Employee { private decimal m_MonthlySalary; public virtual decimal MonthlySalary { get { MonthlySalary = this.m_MonthlySalary; } set { this.m_MonthlySalary = value; } } public virtual void GetYearlySalary() { GetYearlySalary = (MonthlySalary * 12); } } public class Manager : Employee { private decimal m_Bonus; public virtual decimal Bonus { get { Bonus = this.m_Bonus; } set { this.m_Bonus = value; } } public override void GetYearlySalary() { GetYearlySalary = (base.GetYearlySalary() + Bonus); } } public class Exercise1Solution { public virtual void Main() { Employee employee1 = new Employee(); employee1.MonthlySalary = 1000; Console.WriteLine(employee1.GetYearlySalary()); Manager manager1 = new Manager(); manager1.MonthlySalary = 2000; manager1.Bonus = 10000; Console.WriteLine(manager1.GetYearlySalary()); Console.ReadLine(); } } //Bezoek www.vbvoorbeelden.be voor meer C# voorbeelden. //Copyright - De Wolf / vbvoorbeelden - 2003-2011 - Alle rechten voorbehouden.