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 constructor cannot be considered as virtual. This is because there is no virtual table in the memory when executed.
b) Abstraction is done by hiding the data implementation details, and showing only functionality to the user. Abstraction is done to focuse on what the object does instead of how it does it.
c) One can't create an object abstract class since there is an abstract method. If we create an object of abstract class, the body will give an error
Comments
Leave a comment