What is the difference between class and object?

Answer Posted / johncz

Class is a template for the custom type that can be used as
variable. It defines types of data that class contains and
the set of functions to manipulate those data types. It is
just a recipe to be used when class is instantiated.

Object is an entity created using class template. Such an
object occupies computer’s memory. Each object of the class
is independent entity.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What type of loop is a for loop?

877


Why is it so that we can have virtual constructors but we cannot have virtual destructors?

4375


What is polymorphism and its types?

827


how to get the oracle certification? send me the answer

1919


Why do we use oop?

843


What is Difference Between Inheritance and creating object and getting data? means Class A extends B{ B.getMethod();} (OR) Class A{ b obj=new B(); obj.getMethod(); }

2238


What is encapsulation selenium?

775


What causes polymorphism?

846


What does and I oop mean?

858


What is protected in oop?

825


Why do we use class?

838


What is encapsulation and abstraction? How are they implemented in C++?

877


Who invented oop?

861


What is object in oop with example?

980


Question: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date.

953