Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

16. Consider the following statements: I. Base-class constructor functions can be made virtual. II. Derived class constructor functions can be made virtual. III. Base-class member

16. Consider the following statements:

I. Base-class constructor functions can be made virtual.

II. Derived class constructor functions can be made virtual.

III. Base-class member functions can be made virtual.

IV. Derived class member functions can be made virtual.

Which one of the following options is correct?

Group of answer choices

Only III and IV are true statements.

Only III is a true statement.

All four statements are true.

Only IV is a true statement.

22. What is necessary in order to avoid the slicing problem for functions with polymorphic parameters?

Group of answer choices

The function should use a pointer as a parameter, or a reference parameter variable

The function should define all parameter variables as by-value

The function should be defined several times to cover all different parameter types

The function should accept a parameter that is generic

23. The reserved word virtual is used with a base-class member function to alert the C++ compiler that it must determine the actual member function to call at run-time. Thus derived classes can have their own (possibly completely different) versions of the base-class function. When a base-class defines a member function to be virtual, what should each derived class do?

Group of answer choices

Derived classes need to do nothing further

Derived classes should invoke the base-class virtual function

Each derived class should over-ride the virtual base-class function so that it defines a function with the same name that is unique to the derived class

Derived classes should only be used as array elements

27. Consider the code snippet below:

class Question { public: virtual void display() const; virtual void display(ostream& out) const; . . . }; class ChoiceQuestion : public Question { public: virtual void display(); . . . };

Which statement below is true?

Group of answer choices

Question::display() overrides Question::display(ostream& out)

ChoiceQuestion::display() overrides Question::display()

ChoiceQuestion::display() overloads Question::display()

Question::display() erases Question::display(ostream& out)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2005 For Windows Mobile Web Office And Database Applications Comprehensive

Authors: Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

1st Edition

0619254823, 978-0619254827

More Books

Students also viewed these Databases questions