Can someboody explain me classes | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can someboody explain me classes

I didnt understands so well what is that and what is function of class

2nd May 2018, 9:19 PM
Mihailo Sundovic
Mihailo Sundovic - avatar
4 Answers
+ 2
With a class you can create many objects without writing much code. Like in a factory, objects can be mass-produced. Really useful in games, when you want to create 1000 monsters from scratch. https://code.sololearn.com/cjNkd8F0FSVB/?ref=app
5th May 2018, 9:39 AM
Johannes
Johannes - avatar
+ 1
Imagine you have a German Shepherd. Your German Shepherd belongs to the class dog. It has its own personal variables, like breed, weight, color, height, and snout and tail length. All dog objects, like your German Shepherd, come from this blank dog template, known as a class. You can call the doTrick() method on a dog, and each dog may do a different type of trick. Classes are pretty much blank templates of something, so you can reuse it.
2nd May 2018, 10:30 PM
Brendan Degryse
Brendan Degryse - avatar
0
Cpp
2nd May 2018, 9:20 PM
Mihailo Sundovic
Mihailo Sundovic - avatar
0
And if someboody can explayn on Serbian that will be great :)
2nd May 2018, 9:20 PM
Mihailo Sundovic
Mihailo Sundovic - avatar