+ 2

What is the difference between object and class?

6th Aug 2017, 8:29 AM
Otumian Empire
Otumian Empire - avatar
5 odpowiedzi
+ 4
Another example pets-> cat pets-> dog pets-> bird pets is the class and cat, dog, bird are objects
6th Aug 2017, 8:44 AM
Daniel
Daniel - avatar
+ 10
class is blue print of object. example -> house plan->house same as class-> object you can make object from class.😊😊
6th Aug 2017, 8:31 AM
Nithiwat
Nithiwat - avatar
+ 6
An object is an instance of a class. A class is typically a programming construct defined by the programmer to describe an object. An object is created when a class is instantiated. taken from https://cheeze.club/6cq6
6th Aug 2017, 8:32 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 4
The difference bettween An apple tree and an apple. class object Tree fruit from tree
6th Aug 2017, 9:21 AM
Manual
Manual - avatar
+ 1
There's no easy answer to this, but here goes , a object can be created and later be destroyed, due to constructors and destructors. Therefore they live in the program for a limited time. A object has attributes/characteristics which are your data or data members. they also have behaviors or actions which they perform, which are your methods or function members. A class is a blueprint of an object. It describes the features and behaviors of your object. Whereas a object has a limited life, a class has a static life Also you can create as many objects from that class or blueprint . Examples : from a Person class I can create a Rick or a Jane or a Mike object they all have name as a attribute and they can say their name, because of the sayName() method. class Person : # constructor def __init__Person(self, name): self.name = name def __del__(self): # destructor def sayName(self) : return self.name Rick = Person ("Rick") Jane = Person ("Jane") Mike = Person("Mike") print (Rick.sayName ()) and etc... Notice all Persons on Earth have a name attribute , but each name attribute is not the same. Same for a cat, each cat has a name and a age attribute, and behaviors, such as they sleep, they can purr and they can sit. Smartphone is a class, whereas my phone and your phone is the object.Everybody has a smartphone object. Each smartphone object has features/ attributes such as power switch, internet, phone pad, and brand name. The behaviors or actions a smartphone object can do are. makeCall (), isPhoneOn(), and goToBrowser (). and so on. Whatever you want your object to do, or what features/attributes you want for your phone you design in your blueprint(class) in this case is the class called Smartphone.
6th Aug 2017, 9:34 PM
Rick Zalman