What is Object and Class? What are the differences between
them?
Answer Posted / pankaj vashishta
Class is template for creating similar type of entities.
Class doesn't take memory space untill it contains static
members.
In a specific Class, you declare the attributes(field
variables) and its behaviour(functions).
But Class doesn't have any state and identity.
Objects are the real time entity which are created through
their template, thier class.
By real time entity, I mean they would occupy a memory
space in which they will save the values of its atrributes.
These values create a state of an object.
Since Object occupy a space in memory so they have unique
address in memory. This become the identity of an object.
For example : Pen is a class, which has weight and color as
its attribute. They may have behaviour like write().
Still they don't occupy a space in memory.
When I say My pen ,It will be an object of class Pen since
it will have some values for weight like 10 gm and color
like blue. This will occupy some memory to save these
values.
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
What does and I oop and sksksk mean?
Why is static class not inherited?
given a set based questions and 5 questions based on it next data sufficiciency questions 2 and 2/3 english sentence completion with options very easy and 2 synononmys paragraph with 10 questions 10 minutes replace =,-,*,% with -,%,+,* type questions 5 3 questions lik following itssickhere itssickthere itssickhere istsickhere which is nt alike the others very easy
Is oop better than procedural?
which feature are not hold visual basic of oop?
What is encapsulation and abstraction? How are they implemented in C++?
Which is better struts or spring?
What is cohesion in oop?
Can you inherit a private class?
What is the purpose of polymorphism?
What is the diamond problem in inheritance?
What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?
What does and I oop mean?
What type of loop is a for loop?
How is polymorphism achieved?