//Visual Basic 2010 Publieke Members Benaderen Object Oriented Programming namespace Example2 { public class Product { private decimal m_Price; private decimal m_Tax; public virtual decimal Price { get { Price = this.m_Price; } set { this.m_Price = value; } } public virtual decimal Tax { get { Tax = this.m_Tax; } set { this.m_Tax = value; } } public virtual void GetPriceIncludingTax() { GetPriceIncludingTax = (Price * (1 + (this.m_Tax / 100))); } } public class Client { public virtual void Main() { Product product1 = new Product(); product1.Price = 1000; product1.Tax = 21; Console.WriteLine((product1.Tax == 21)); Console.WriteLine((product1.GetPriceIncludingTax() == 1210)); Console.ReadLine(); } } //Bezoek www.vbvoorbeelden.be voor meer C# voorbeelden. //Copyright - De Wolf / vbvoorbeelden - 2003-2011 - Alle rechten voorbehouden.