Can someone please give a good in-depth description of what "classes" are? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone please give a good in-depth description of what "classes" are?

I can't seem to get it through my head. All thhroughout this app, I totally am not understanding classes.. Why not just have everything under the same class? Aren't classes supposed to be premade? (I know ROBLOX Lua currently.. And I believe that's why it is harder for me to understand this concept of "making" classes.. Rather than having premade, preset classes to items and such.. Please help!

19th Jul 2016, 8:38 AM
Tristan
2 Answers
+ 3
Classes are like design...think of it as a design for a room,which is imaginary view of what the room will look like.Objects are the real room,which is made using classes and methods are different things inside the room that perform different things...like fan,table etc. Classes are used to approach a problem in a step by step manner.They are also used so that once you made a classes , this class can be used to make objects elsewhere and hence you don't have to write the code again.Hope it helps!
19th Jul 2016, 8:53 AM
Sagar Sureliya
Sagar Sureliya - avatar
- 1
Hello classes and object Class are thae kind of some thing Object is a thing that from the kind of the class Imagine with me class is Cars You know that we make the class only one time and from it make 10000000+ objects in the class we but the things that match with all class object any thing in the world from any kind has 2 things attrbiudes and methods right? Ok itis the same Imagine that we have in the class car attributes name model And methods is stop move Ok this things in all cars So i make the class one time so i will make object like Name: toyota model :2016 The methods know it just now that it donot change ( in advanced lessons you will change it but not now) then from this class i can make 1000387373+ obj Nissan,Bmw....etc with the same methods and different attributes The class is like a map to the computer and after that you say to him the real attributes in object like you said to it names and after that in obj you declare the values
19th Jul 2016, 8:58 AM
Mostafa Abobakr
Mostafa Abobakr - avatar