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 is encapsulation in simple terms?
What is an advantage of polymorphism?
write string class as your own class in java without using any built-in function
what is different between oops and c++
What are two types of polymorphism?
What are the data types in oop?
What are main features of oop?
Why do we need oop?
Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)
What is oops with example?
what is graphics
How do you achieve polymorphism?
Write a program to sort the number with different sorts in one program ??
What is oops concept with example?
How to use CMutex, CSemaphore in VC++ MFC