Hi guys,
What are the benefits of defining a property for a object instead of giving direct access to the private variable?
Instead of :
public class A
private _x as integer = 0
Public property X() as integer
Get
return _x
End Get
Set(ByVal value As integer)
_x = value
End Set
End Property
end class
Why we can't do following:
public class A
public _x as integer = 0
end class
What are the benefits?