+ 3

What is the basic difference between a object and a variable ?

PS... please explain a little bit about oops if you can

25th May 2017, 8:22 PM
suhil koul
suhil koul - avatar
4 odpowiedzi
+ 8
A variable is nothing but a named stored location which holds known or an unknown value. A variable can be initialized in a standard manner. The name variable is given, as a variable can be assigned any value; even const variables are initialized while declaration. Object is just a fancy name given to user defined variables. Having said that, objects are a bit special. Objects are variables : but they are instances of user defined types called as classes or structures (structs). https://www.quora.com/What-are-the-differences-between-a-variable-and-an-object-in-object-oriented-language
25th May 2017, 8:47 PM
Mohammad Dakdouk
Mohammad Dakdouk - avatar
+ 2
a variable is a place to hold data. an object has pre-defined values/functions attributed to it
25th May 2017, 8:44 PM
Welliton Malta
Welliton Malta - avatar
+ 2
Simple variable can only hold one value (string, number, boolean etc). Object can hold pairs of variables and values, also that object model can be used for another object just different values, and oop is based on that, using same code multiple times with diff value s without rewriting it.
25th May 2017, 8:46 PM
Amar
Amar - avatar
0
the two are containers _the major difference is that variable contain or carries value while object carries both variables and values
30th May 2017, 12:23 PM
Eriba Stephen
Eriba Stephen - avatar