//Visual Basic 2010 Implementatie Object Oriented Programming namespace Example2 { public class Product { private decimal m_Price; private decimal m_TaxPercentage; private decimal m_PriceIncludingTax; public virtual decimal Price { get { Price = this.m_Price; } set { this.m_Price = value; this.setPriceIncludingTax(); } } public virtual decimal TaxPercentage { get { TaxPercentage = this.m_TaxPercentage; } set { this.m_TaxPercentage = value; this.setPriceIncludingTax(); } } public virtual decimal PriceIncludingTax { get { PriceIncludingTax = this.m_PriceIncludingTax; } } private void setPriceIncludingTax() { this.m_PriceIncludingTax = (Price * (1 + (TaxPercentage / 100))); } } public class Client { void Main() { Product product1 = new Product(); product1.Price = 100; product1.TaxPercentage = 8; Console.WriteLine(product1.PriceIncludingTax); Console.ReadLine(); } } //Bezoek www.vbvoorbeelden.be voor meer C# voorbeelden. //Copyright - De Wolf / vbvoorbeelden - 2003-2011 - Alle rechten voorbehouden.