---
title: "instance variables and class variables"  
description: "instance variables and class variables"  
author: "Anonymous User"  
published: 2018-07-20  
updated: 2019-04-03  
canonical: https://www.mindstick.com/forum/34631/instance-variables-and-class-variables  
category: "python"  
tags: ["python"]  
reading_time: 1 minute  

---

# instance variables and class variables

How are [instance variables](https://www.mindstick.com/interview/22913/what-are-local-and-instance-variables-in-java) different from [class variables](https://www.mindstick.com/blog/10879/language-basics) in [python](https://www.mindstick.com/articles/75378/simple-yet-useful-tips-when-using-python) ?

## Replies

### Reply by Ben Affleck

Post is removed by the Admin.

### Reply by bear pu

Post is removed by the Admin.

### Reply by Prakash nidhi Verma

[instance](https://www.mindstick.com/forum/155658/testing-connection-to-cloud-sql-instance-with-a-mysql-client-from-vm-instance) [variables](https://www.mindstick.com/articles/715/php-variables) different from [class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp) variables :

Instance variables are variables that are created locally within a class to refer to an object of the class. class variable is which is created globally in a class and its accessible within all instance of that current class.

class variables are declared with keyword static and Instance variables are declared without static keyword.

Class variables can be accessed anywhere within that class while an instance variable can only be accessed within the particular object of the class.

As class variables are common to all objects of a class, changes made to these variables through one object will reflect in another. instance variables are own copied of each objects.we cant change in any object.

Class variables can be accessed using class name/object reference. Instance variables can be accessed only through the object reference.


---

Original Source: https://www.mindstick.com/forum/34631/instance-variables-and-class-variables

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
