Learn the difference between a class variable and instance variable. The values of instance variables can be unique or different for each instance or each class object. However, the values of class variables will be same for each class object. Class variables are shared by all instances of a class. Class variables are always defined outside of the class’s methods. We can also provide a different value of class variable for specific class object. In such case, only that specific class object will have a distinct value for that class variable, while all the remaining class objects will have the same value for the class variable.
We can access the class variables using the class name as well as object name, but it is preferred to use object name so that we can get correct values even if some class objects have different values for class variables.

Subscribe: https://www.youtube.com/channel/UC-FZ9Vs5uXEAwcmrOoKoCjA


(OOP) Class Variables in Python
3.35 GEEK