0

What are Attributes, methods and Behaviors in a class?

Real life analogy helpful. Confused a lot.

15th Jul 2017, 6:51 AM
Sai Yerni Akhil
Sai Yerni Akhil - avatar
1 Odpowiedź
+ 1
Objects are an instance of a class. Just like objects/things in real life, it has attributes(variables) and behavior/functions. The best comparison I've heard is with a lego. A lego has attributes like heigth, width, number of bumps, color, etc. It also function(ality) such as clicking onto another lego. These are all described in a class. Some people overlook the idea that objects in coding are "literally" objects. There is very little difference between objects in coding and objects in real life.
15th Jul 2017, 7:29 AM
PiGuy Harris
PiGuy Harris - avatar