There is no requirement to have a property in a class, and there is no
correlation from a constructor to a property. A property is simply a way of
encapsulating the desire to change a value of a facet of the object.
Some things, such as binding, only work with properties and not members.
Properties can be used to mask certain pieces of code behind the scenes.
For example, if you have a property on an object of class TicTacToeCell,
called CellValue, you may desire in the property set method, to check the
board to see if it causes a "win". If you did this with members rather than
properties, it would be somewhat more difficult.
I hope this helps a little.
"RP" wrote:
I am still not following why a constructor and a property [with
GET ... SET] is used simultaneously. I noticed it in many examples. I
am new to OOP. The class which I created [see my original post] uses
both a constructor and properties. After setting values in property, I
am puzzled where to use a constructor and for what?
On Nov 8, 11:30 am, Andy Mueller <m...@privacy.netwrote:
No. Only if you want to change the property *after* the object has been
constructed