What is the difference between class and structure?
Answer Posted / arvind
The main difference is
Structure ... Class
struct . Class
{ . {
data members ... data members
} ... +
... Member functions
... }
We can't define Functions inside structure where as in class we can define inside
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
What is pure oop?
Why do we use class in oops?
What do you mean by overloading?
Can you explain polymorphism?
What is encapsulation in oop?
Where You Can Use Interface in your Project
What is the example of polymorphism?
What is encapsulation with real life example?
Can an interface inherit a class?
What are objects in oop?
What does enum stand for?
What are functions in oop?
What are the 4 main oop principles?
INSTANCE FIELDS DECLARED private ARE ACCESSIBLE BY THE METHODS ONLY.CAN WE CHANGE THE private FIELD OF AN OBJECT IN A METHOD OF SOME OTHER OBJECT OF THE SAME CLASS?
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.