Attribute vs Property

liunx

Guest
In OOP terms what the difference between attribute and property?Could be anything: neither has a formal definition "in OOP terms". The specification for one language might use "property" to describe a method or pair of methods that simulate a field, and use "attribute" to describe embedded compiler hints. Another language might use them to mean something completely different.Within the online PHP manual, I've seen class variables referred to as both "properties" and "members", and I tend to think of them from "attributes", as that's the first thing I recall hearing them called. :rolleyes:The idea behind the uniform access principle (<!-- m --><a class="postlink" href="http://en.wikipedia.org/wiki/Uniform_access_principle">http://en.wikipedia.org/wiki/Uniform_access_principle</a><!-- m -->) is that you are not supposed to be able to tell the difference between instance variables, fields, attributes, properties or accessor methods.In C# you certainly can tell the difference between attributes and properties; they look totally different. Of course, that's dependent on how Microsoft defines "attribute" as it applies to C# ....The implementation looks different. The idea is that the interface shouldn't.Unless "property" and "attribute" refer to different concepts in the environment of interest.I go by Java terms... data members, methods, etc...but I also tend to use data members and variables interchangeably. With attributes and properties, as long as you are conveying what you are talking about clearly, you should be OK.dont be confused with attribute, property and parameters. They are simple--
attributes are set on objects, and an object can have different attributes, and futher each attribute can have various properties.and the parameters you can say are the arguments passed with some function like get_attribute_name()...
 
Back
Top