What is an instance? What is it to do with class, method or function? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is an instance? What is it to do with class, method or function?

20th Aug 2016, 7:48 AM
Farid Rifaie
Farid Rifaie - avatar
4 Answers
+ 3
An instance is an actual creation of something. A class is just a set of rules. An object is an actual instance of the class. For example, "human" is a class of things. But I, Taylor, am an instance of a human.
23rd Aug 2016, 12:46 AM
Taylor Street
Taylor Street - avatar
+ 1
class Worker: def __init__(self,name): self.name = name worker1 = Worker("Eric Taylor") worker2 = Worker("Jim Ross") # worker1 and worker2 are 2 istances of the class Worker # and they are two objects made with the bleprint of class Worker
9th Sep 2016, 2:53 PM
Giovanni Gatto
Giovanni Gatto - avatar
0
an object is an instance of its class
22nd Aug 2016, 2:05 PM
Paloma A
Paloma A - avatar
0
An instance is an previously unknown object or product of it's class !
16th Dec 2016, 12:07 AM
Ronald Keith