+ 3
for eg: circle....now its attributes and behaviour will be?
8 Answers
+ 2
attributes can be radius, circumference, area
+ 2
I do not agree with most of the answers here. MOST ARE WRONG!!!
So let's answer this.
Firstly, Definitions or Analogy.
- Attributes are what you can use to describe an object. e.g "black" hair, "blue" eyes, "long" legs etc.
- Behaviours includes how those attribute works.
So in short, Behaviours can work on Attributes but Attributes Cannot work on Behaviours.
Back to your Questions and the answers provided...
1. Radius: is an attribute because it is a measure of the part of a circle. NOT how a part works!
2. Circumference: is a BEHAVIOUR!!! don't be confused to think this is an attribute (property) because it is the distance round a circle. It is actually a behaviour that depends on the radius and value of PI. remember circumference = 2 Ă PI Ă r. If you will be coding this, you will make it a method (behaviour) not a property (attribute) .
3. Area: is a BEHAVIOUR!!! same reason as no 2
4. Diameter: can be either be an attribute or a behaviour depending on how you intend to see it. If you want to see it as a function of radius, then it is a BEHAVIOUR. else attribute.
I believe, by now, you should understand how to classify behaviour (methods) and attributes (properties).
In summary, if what you want to classify can be written as a function, then it is a behaviour of some properties...
+ 1
attribute will be radius
+ 1
createCircle() will be behavior
+ 1
attribute will be the radius,diameter,circumference and area.. behaviour can be semicircle,segment of circle.. like how all circle can change with angle..
0
thanks
and what about its behaviour......
0
thanks alot everyone..it helps...
0
behavior could be like Circles rolls.