+ 1
Python - Classes
Can someone explain me what is a class and what it does? Maybe with some practical examples :)
1 Answer
+ 1
https://code.sololearn.com/cQNc123S9a9t/#py
Here is an example of one I made the other day. A class can be anything from a simple collection of related data, to a complex function that produces an output. Unlike a simple function the class exists until it is overwritten, destroyed or the application closes. A functions values only last for the one iteration. However even after this finishes processing I can call back a value from the class, or create a new one and compare them to each other. A class could also have multiple methods depending on when or if you needed to perform additional actions using that data.
That's the concept. You can go from very simple to extremely in depth.
Hope that helps!
~Jim