Answer Posted / gp
Class which cannot be initiated is an abstract class.
You can make a class abstract by declaring a pure virtual method inside the class. For example:
class base
{
void func()=0;
};
void main()
{
base b;
}
Now you cannot instantiate base class.
The class which inherits this base class will also become abstract unless you define a body of the func() method in inherited class.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What do you mean by abstraction?
i got a backdoor offer in process global,Bangalore..Can i work with it?
class type to basic type conversion
What are functions in oop?
What is a function in oop?
What is the importance of oop?
What is the real life example of polymorphism?
What is the purpose of enum?
What is interface in oop?
They started with the brief introduction followed by few basic C++ questions on polumorphism, inheritance and then virtual functions. What is polymorphims? How you will access polymorphic functions in C? How virtual function mechanism works?
What makes a language oop?
can we make game by using c
What is the difference between static polymorphism and dynamic polymorphism?
Who invented oop?
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.