I need reasonably brief, but complete answers for the following few questions that I am stuck on.
1.a) Suppose class Y is derived from class X. Each class declares
a constructor and a destructor. Class Y has a string member
object that has a constructor and destructor. In what order do
the three constructors and destructors run when instances of
class Y are created and destroyed?
b) Should X’s destructor be declared virtual? Why or why not,
and what difference would it make?
2. What is a pure virtual function? Why would you define a pure
virtual function? Give an example of a pure virtual function.
3. What is an abstract base class? What does it do? Why would you
make a class abstract?
4. What are the advantages of using an stl::string to hold character
data vs. a dynamic char array?


0 comments