Answer the following short questions. Your answer should be precise.
a) Can we declare base class constructor or destructor as virtual if yes then why we want to do?
b) How we can declare a class as abstract and why we need abstract classes?
c) Why we cannot able to create objects of abstract classes give reasonable justification of that.
a) The answer is yes.
The most derived method is invoked when calling a function having an object pointer
b) We declare an abstract class by writing the keyword abstract before the name of the class. The work of abstract classes is to provide a base class whose members and method can be inherited by other classes.
c) We cannot create instances of abstract classes since abstract classes contains methods that has no body definition.
Comments
Leave a comment