+ 5
are classes basically a collection of functions?
^^classes are the most difficult part of coding
2 Réponses
+ 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.
+ 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)"