What are classes in python? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 3

What are classes in python?

23rd Feb 2019, 9:11 AM
Ashish Ranjan
Ashish Ranjan - avatar
10 Antworten
+ 4
A way to tie related functions and data together.
23rd Feb 2019, 9:36 AM
HonFu
HonFu - avatar
+ 2
Can u explain in brief?
23rd Feb 2019, 9:24 AM
Ashish Ranjan
Ashish Ranjan - avatar
+ 2
Classes can simply be used to add namespaces to variables and functions to separate from other variables and functions, that might have the same name. Classes can also have a constructor, which gives them bigger meaning and allows class to create objects.
23rd Feb 2019, 9:57 AM
Seb TheS
Seb TheS - avatar
+ 2
tbh th best way to understand classes is with uniform modelling language(uml). unfortunately sl doesnt allow you to post diagrams so you’ll just have to do a web search.
23rd Feb 2019, 8:14 PM
Logomonic Learning
Logomonic Learning - avatar
+ 1
Classes are some like defining a function.. but they have special abilities, in which you can describe their attributes and then how they work.. When you study about classes the simple definition given was about a dog class which have attributes like , colour , name, etc.
23rd Feb 2019, 9:48 AM
Aakash Gupta
Aakash Gupta - avatar
+ 1
class is nothing but user defined datatype syntax : class classname: def _init_(self): statement
25th Feb 2019, 4:50 AM
sree harsha
sree harsha - avatar
+ 1
Classes are the blueprint of real world objects. Classes always have objects which are representatives of that. Now objects have two things state and behaviour. Classes came into the picture when we started talking about OOP'S concept that is object oriented programming. For e.g student studying in school is a CLASS, Where every student has a name and id, BUT every student posses different behaviour and state like some are hardworking,some are sports enthusiast,some are dull. We use classes to ease our work in programming and properties like extending a class so that we dont have to write some similar code many times i.e INHERITANCE, also when we want to hide our data so to ensure the security i.e ENCAPSULATION , So thats why we use classes which ease our work and bind all the data ,methods all together.
25th Feb 2019, 6:27 AM
Salman Ahmad
Salman Ahmad - avatar
0
Can i get some upvotes on my question
24th Feb 2019, 12:21 PM
Ashish Ranjan
Ashish Ranjan - avatar
0
I coding education
4th Mar 2019, 10:39 PM
Troy Peppers
Troy Peppers - avatar