0
9.8kviews
Explain the concept of values and attributes.

Subject: Object Oriented Modeling and Design

Difficulty: Medium

Marks: 4 Marks

1 Answer
0
731views

Value: - A value is a piece of data.

Attributes: -

  • An attributes is a named property of a class that describes a value held by each object of the class.
  • A class may have any number of attributes or no attributes at all.
  • An attribute represents some property of the thing that is shared by all the objects of that class.
  • Each attribute name is Unique within a class. Each attribute has a value for each object.
  • For example, attribute Name can have value as „abc‟ for one object and „xyz‟ for other object. Attributes are listed in the second part of Class Box.
  • Each attribute name may be followed by data type of the value and optional default value. A colon precedes the type and equal to sign precedes the default value.

  • For Example: Class Person has attributes Name, Birthdate and weight. Name is string, Birthdate is Date and Weight is integer.

enter image description here

Please log in to add an answer.