What is the difference between class and a function? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the difference between class and a function?

21st Feb 2016, 1:21 PM
Ajmal Hassan
Ajmal Hassan - avatar
2 Answers
+ 7
A class may contain several methods, or functions, that all act to help build an object. A function completes a set of actions. Think of functions as your tools, then a class would be a toolbag all for a specific type of job.
24th Mar 2016, 4:58 AM
Joseph
0
think of class as a recipe or blue print for building something while function is a block of command that does something
8th Jul 2016, 6:48 AM
Sunusi Muhammad Raji
Sunusi Muhammad Raji - avatar