0
What is the different between property and a Field
I mean aren't they all declared at the Class Code block
1 Respuesta
+ 1
It is actually very simple. A field is used within your own class and a property is accessed outside of it. When declaring an field you will see it is private and an property is public. This follows the principles of OOP and encapsulates your data.
When making you constructor and to strings you should always use your properties otherwise you are breaking the rules of OOP and rendering properties futile which it is not.