//Visual Basic 2008/2010 Implementatie Object Oriented Programming namespace Example1 { 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 void GetPriceIncludingTax() { GetPriceIncludingTax = 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.GetPriceIncludingTax()); Console.ReadLine(); } } //Bezoek www.vbvoorbeelden.be voor meer C# voorbeelden. //Copyright - De Wolf / vbvoorbeelden - 2003-2010 - Alle rechten voorbehouden.