+ 3
What are classes in python?
10 Respostas
+ 4
A way to tie related functions and data together.
+ 2
Can u explain in brief?
+ 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.
+ 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.
+ 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.
+ 1
class is nothing but user defined datatype
syntax :
class classname:
def _init_(self):
statement
+ 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.
0
Can i get some upvotes on my question
0
I coding education