What is an object (instance)? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

What is an object (instance)?

im having trouble with identifying instances. are those variables?

6th Oct 2017, 1:36 PM
Geena Nana
Geena Nana - avatar
8 Answers
+ 6
https://www.sololearn.com/Discuss/768419/what-is-an-instance ^Posted a response to you in your original thread. "Think of it like this. A class is a "blueprint" for something you want to build in the world. An "instance" is the object that you create with that blueprint. The original blueprint (class) isn't changed or affected by anything that happens to the object you created, and you can use the blueprint (class) to create more of the object as needed. So to summarize, the class is the blueprint for the objects, and each object you create is its own individual instance."
6th Oct 2017, 1:44 PM
AgentSmith
+ 3
classes are are like templates, we actually don't use class but we use them to mk their look alike called objects , with which we carry our tasks, hence they say objects are instances of a class
6th Oct 2017, 1:44 PM
Morpheus
Morpheus - avatar
+ 3
thank you all! im starting to understand. There'll definitely be more questions cuz im taking a course in java now😊 we're doing loops,returns and validating email address, but as you can see..im far behind lol.
6th Oct 2017, 1:49 PM
Geena Nana
Geena Nana - avatar
+ 3
let's say u have a box of fruits, the box will be the class, different fruits within the box will be objects/instances of class and let's say each fruit has a distinct color,smell,taste etc these will be class variables/object attributes.
6th Oct 2017, 4:17 PM
balachandar
balachandar - avatar
+ 2
think of class like a sophisticated data type and object its value, like suppose a class animal{}; int NUM = 5; animal dog={something something}; see the similarities int and animal both data types NUM and dog both like variables and after = their values
6th Oct 2017, 1:48 PM
Morpheus
Morpheus - avatar
+ 2
To really understand class and object , think of class like a variable that host composite data like array ..Array can host many data .likewise class host composite data but beside hosting many data it host function which is call led method.A class host many data like colour ,price , function which you can call through object of that class .Therefore object is an implementation of that class...Don t be rushed it takes time really understand it..
11th Oct 2017, 6:55 PM
Marshial Dominik
Marshial Dominik - avatar
+ 1
object is a thing
6th Oct 2017, 6:20 PM
Sagar Chauhan
Sagar Chauhan - avatar
0
Implementation of class, to be short.
6th Oct 2017, 5:11 PM
Freezemage
Freezemage - avatar