Using the this Object Reference
public class Product {
public int yearBuilt;
public void SetYearBuilt(int yearBuilt) {
this.yearBuilt = yearBuilt;
}
}
class MainClass{
public static void Main() {
Product myProduct = new Product();
myProduct.SetYearBuilt(2000);
System.Console.WriteLine("myProduct.yearBuilt = " + myProduct.yearBuilt);
}
}
Related examples in the same category