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


Please Help Members By Posting Answers For Below Questions

What is encapsulation with example?

570


What is object in oop?

671


How can you overcome the diamond problem in inheritance?

761


write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory

2748


Write A Program to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtual Functions)

3550






write a program to find 2 power of a 5digit number with out using big int and exponent ?

1887


Which is not an object oriented programming language?

530


Which method cannot be overridden?

572


What are the 4 main oop principles?

669


Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.

687


Can bst contain duplicates?

660


2. Give the different notations for the class.\

1580


Why polymorphism is used in oops?

575


Write a program to reverse a string using recursive function?

1784


assume the program must insert 4 elements from the key board and then do the following programs.sequential search(search one of the elements),using insertion sort(sort the element) and using selection sort(sort the element).

1662