0
What are Attributes, methods and Behaviors in a class?
Real life analogy helpful. Confused a lot.
1 ответ
+ 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.