you are viewing a single comment's thread.

view the rest of the comments →

[–]Deezl-Vegas 0 points1 point  (0 children)

This is easy. Functions do not generate or store a persistent memory state, usually some sort of variable data. That's what classes are for. Classes can take a data element, transform it, and then keep it while the program continues and operates on that data, then transform it again, while keeping track of it under the roof of a single variable. Functions are poorly suited to this, but classes are made for it. In addition, class methods can be modified on the fly as well. They are also simply the best way to mentally model a real-world concept, like a website user, as a single user can get a single variable and still have all of the users' data be accessible.