are classes basically a collection of functions? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

are classes basically a collection of functions?

^^classes are the most difficult part of coding

20th Mar 2017, 2:42 PM
DeleteThisAccount
2 Answers
+ 8
Technically it can be, but generally no. Treat classes like your classroom(some pun intended) Your teachers are your constructor, when the class starts, your teacher will do something. [Aka when a class is being called initalized, it will do something] After that you have your students, table and chairs, etc. [Your functions, structures, etc etc.] Finally you have your clock ringing, those are your destructors. After your clock rings, something happens.[After your class is not in use anymore, something happens] Also, the principle like to do information exchange., so ge make 3 class go for a information exchange at one main classroom A. [the 3 classroom inherits from A] and there will never be one classroom who is assigned to more than one main classroom.
20th Mar 2017, 3:05 PM
Wen Qin
Wen Qin - avatar
+ 1
No. It's basically the Blue print of an object in OOP. "In object-oriented programming, a class is an extensible program-code-template for creating objects, providing initial values for state (member variables) and implementations of behavior (member functions or methods)"
20th Mar 2017, 3:06 PM
Eranga
Eranga - avatar