Answer to Question #213952 in C++ for ali

Question #213952

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.           



1
Expert's answer
2021-07-05T13:32:42-0400

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.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS