Friday 27 February 2015

Difference between properties and attributes

The Difference between an Attribute and a Property To add or provide an additional perspective;
An Attribute is a descriptor of the Class (Class as opposed to instances or objects of the class) and are common/exists in, and of, all created instances of the class
whereas
A Property offers variance among instances/objects of the class.
For example, use an automobile as the class and think of different instances of an automobile:
Attributes: (these exist in all instances/cars)
1. 4 Wheels (hopefully!)
2. Headlights
3. Engine
4. Seats
Properties: (these allow variances in each instance/object)
1. Color [ Blue | Red | Grey ]
2. Rear Spoiler [ True | False ]
3. Engine Bore [ 5.7L | 5.0L ]
4. Seat Style: [ Leather | Cloth | Vinyl ]