Join my course at Udemy (Python Programming Bible-From beginner to advanced )

Blogger templates

Sunday 9 August 2020

What is difference between class and object in python ?

 

class’ and ‘object’ in python is little confusing for people having C++ or JAVA background. In Python everything is an object, for example- integer is a object, float is a object, list, dictionary etc, everything is an object in python.

So in this way a class is also a object (class object) and instance created from a class is also an object (instance object) in python.

From design perspective, you can think class as a template that is placeholder for data and related methods. Object (Instance object) is created/instantiated from the class with real values.

Share:

0 comments:

Post a Comment

Feature Top (Full Width)

Pageviews

Search This Blog