0

What is the meaning of Classes?{SOLVED}

I dont get the Classes because why cant I just make a Array that act like Classes like Goblin ={100,10,5} instead of doing Class Goblin: and a bounce of Functions can someone help me find a better understanding of using Class?

18th Oct 2018, 10:13 PM
Vanessa Nilsson
4 ответов
+ 1
Aa thank you for explaining
18th Oct 2018, 10:57 PM
Vanessa Nilsson
0
If your codes get bigger, it might be easier to use classes. The point is: Normally your functions all sit at the top, right? Or maybe declared at the top, defined at the bottom. Now say you have not only goblins, but all sorts of monsters, heros, places, weapons, vessels, castles or whatnot. They all will need their own functionality, right? How will you keep order? By writing classes, you bind together everything that belongs to, say, a goblin: All his stats, equipment, fighting skills and so on. You have it all in one place and you isolate it to a large degree, so that it doesn't interfere with other parts of your code.
18th Oct 2018, 10:53 PM
HonFu
HonFu - avatar
0
I have myself only recently written my first two classes for practice. Do you want to take a look? :) Maybe it gives some idea, since it is 'beginnerish' and so maybe somewhat closer and easier to grasp than advanced examples. https://code.sololearn.com/cphX7Huyehki/?ref=app https://code.sololearn.com/cgHiYH23Utt7/?ref=app
18th Oct 2018, 11:03 PM
HonFu
HonFu - avatar
0
Thank you but I know how to use them I just didnt understand why you would use but thanks I Will check these out
19th Oct 2018, 11:43 PM
Vanessa Nilsson