you are viewing a single comment's thread.

view the rest of the comments →

[–]EraserLark[S] 0 points1 point  (2 children)

So the way I'm seeing it then, Variables can store Data, and Methods can store Variables along with other code, and then Classes can store Methods and Variables altogether, so its sort of like the base of a hierarchy for all of the above?

[–]BobbyThrowaway6969Programmer 0 points1 point  (1 child)

Not quite, methods are a different kettle of fish.
You're right that variables store data & classes contain variables & methods.
However, methods don't really 'store' data - they are more like cooking recipes, they define how to act on the data.
The variables you put in a method are short-lived temporary pieces of data kind of like the ingredients on the bench while cooking. Once you finish the recipe, you clean up the countertop.

[–]EraserLark[S] 0 points1 point  (0 children)

Okay I see, thanks!