#24 - (OOP) Class Variables in Python

Published: 23 March 2021
on channel: Tech Vitals
473
15

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.

Facebook:   / techvitals  


On this page of the site you can watch the video online #24 - (OOP) Class Variables in Python with a duration of hours minute second in good quality, which was uploaded by the user Tech Vitals 23 March 2021, share the link with friends and acquaintances, this video has already been watched 473 times on youtube and it was liked by 15 viewers. Enjoy your viewing!