In C# to define a property you write:

visibility typename propname { [visibility] get; [visibility] set; }
-or-
public int Age { get; set; }

This means you have a read write property that does nothing special. You
could also write ...

private int age;
public int Age { get { return age; } set { if (value > -1) age = value; } }

To use private a backing with code invoked to set or get. And finally you
can also write:

public int Age { get; private set; }
-or-
public int Age { get; private set; }
-or-
public int Age { get; protected set; }

To limit access to either a setter or getter of a property.
-- 
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to