+ 3

for eg: circle....now its attributes and behaviour will be?

22nd Aug 2016, 3:20 PM
Kashan Siddiqui
Kashan Siddiqui - avatar
8 ответов
+ 2
attributes can be radius, circumference, area
25th Aug 2016, 2:14 PM
Suhas M
Suhas M - avatar
+ 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...
17th Nov 2016, 1:30 PM
Toheeb
Toheeb - avatar
+ 1
attribute will be radius
24th Aug 2016, 11:30 AM
shridhar metraskar
shridhar metraskar - avatar
+ 1
createCircle() will be behavior
24th Aug 2016, 8:17 PM
shridhar metraskar
shridhar metraskar - avatar
+ 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..
3rd Sep 2016, 4:52 AM
Tom P Samuel
Tom P Samuel - avatar
0
thanks and what about its behaviour......
24th Aug 2016, 2:48 PM
Kashan Siddiqui
Kashan Siddiqui - avatar
0
thanks alot everyone..it helps...
25th Aug 2016, 2:35 PM
Kashan Siddiqui
Kashan Siddiqui - avatar
0
behavior could be like Circles rolls.
8th Sep 2016, 3:33 PM
Alpha Josephs
Alpha Josephs - avatar