0
What the difference between functions and classes?
2 Answers
+ 2
Think of a class as a collection of attributes. Which attributes is completely up to you. Height, width, color price, score, units... Basically, the attributes are the input data you are interested in.
A function is a method to manipulate input. Multiply units x price, or height x width, ask a question quiz and check the user's input, change the color. Or print the input to a file. These are all done in functions.
0
Long story short, class is a special kind of namespace that allows you to instantiate objects with state.
Function doesn't have state, it's merely a subprogram you may call.