What i think class can do | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What i think class can do

This is my guess and question on class. I could be horribly wrong about it as im still confused. Can i use class to make, lets say a monster which i then store variables like its health and damage and function to die if its health is 0

10th Sep 2017, 2:52 PM
jayrn02
jayrn02 - avatar
2 Answers
+ 4
You're spot on. The variables are called attributes, and the functions are called methods.
10th Sep 2017, 2:59 PM
chessmonster
chessmonster - avatar
+ 3
The class is the blueprint of the definition of a monster. What it is and can do. An object is a specific monster.
10th Sep 2017, 3:44 PM
josh mizzi
josh mizzi - avatar