- Source: http://www.wwwcoder.com/
- By venkatarama uppugunduri
These are at least a confusing term in the programmer's world. Their meanings are often exchanged.
Here is my opinion on them.
Attributes discusses the nature of the topic. Properties discusses the property, content, status, or ownership of all things in the topic.
Let's say that I am a human. On this premise, humans are an attribute of my theme ). Just like there are people and dogs in my apartment, the people here are properties with the apartment as the theme ).
The same thing appears in the. NET world. For example, serializable is the attribute of an instance object, and the object may have an attribute that uses the expected true or false Boolean value to indicate that the object can be serialized. This will tell. net runtime: This class can express the serialization capability through attribute, and does not need to use the property exposed by it) the class is serializable.
Therefore, attribute defines the unique nature or nature of a topic, and property belongs to this topic. In the object-oriented example term, the attribute (feature) related to the subject should have the following meanings: "What is it", and the property (attribute) should have the following meanings: "what ".
Example
- People are human beings. Here humans are an attribute ).
- People have wings. The wings here are properties ).
What about field and property? Most of the time we will hear that fields and properties sometimes sound similar, and sometimes they sound different. In fact, fields (field) defines the areas required to store the value or topic status, while properties (attribute) not only presents the status or value, nothing else.