Question

Which of the following is a virtual function declaration for Print(string str) from class Book? Select...

Which of the following is a virtual function declaration for Print(string str) from class Book?

Select one:

a. virtual Print(string str);

b. void Print(virtual string str);

c. void virtual Print(string str);

d. virtual void Print(string str);

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer) d. virtual void Print(string str);

if we want to declare the function as virtual, first we have to write that keyword before the function name afetr that we have to write the return type of that function .After that we have to write the function name.

_______________Thank You

Add a comment
Know the answer?
Add Answer to:
Which of the following is a virtual function declaration for Print(string str) from class Book? Select...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • e fellowing class declaration to answer the questionist below class WeatherStation public emp, double wind, string...

    e fellowing class declaration to answer the questionist below class WeatherStation public emp, double wind, string wind dir, double prediplk void void void int Winda int getTempo double getWindSpeed) : string getWind Direction): double getPrecipitation: void setTemp(int t void setWindData(double w, string dir): void setPrecip(double pl printTempO private int temperature double windSpeed, precipitation string windDir method 14) 14) Refer to the class declaration above. Which of the following methods is an accessor A) int WindChillo: C) WeatherStation: B) void setPrecipO...

  • use c code to Develop a function void printToggled(char str[]) that gets a string as a...

    use c code to Develop a function void printToggled(char str[]) that gets a string as a parameter and prints every lowercase character as an uppercase one and vise versa. For example, if the string submitted as a parameter is Hello WorlD! The function should print hELLO wORLd! Hint:answer must include output

  • Q1. Write a recursive function in C++ void printNumberedChars(string str, int i=0) { ... } which...

    Q1. Write a recursive function in C++ void printNumberedChars(string str, int i=0) { ... } which prints each character of the given string str on a new line, with each line numbered 1, 2, 3, …. For example calling the function with printNumberedChars("hello"); should output the following: 1. h 2. e 3. l 4. l 5. o Q2. Write a recursive function in C++ int sumArray(const int* arr, unsigned int size) { ... } which takes an array of integers,...

  • using c language String Challenge Have the function StringChallenge(str) read str which will contain two strings...

    using c language String Challenge Have the function StringChallenge(str) read str which will contain two strings separated by a space. The first string will consist of the following sets of characters: +, *, $, and {N} which is optional. The plus (+) character represents a single alphabetic character, the ($) character represents a number between 1-9, and the asterisk (*) represents a sequence of the same character of length 3 unless it is followed by {N} which represents how many...

  • 8. Suppose class D is derived from class B, and class B has a public member...

    8. Suppose class D is derived from class B, and class B has a public member function that is virtual whose declaration is virtual void fO:, and another publie member function that is not virtual whose declaration is void g):. Suppose class D has its own version of the two functions void 1() and void gO. Here below is a pointer definition and access to the member functions f) and gO Suppose this is embedded in an otherwise correct and...

  • c. [3 marks] Given the following definition of the class MyClass, class MyClass { String s...

    c. [3 marks] Given the following definition of the class MyClass, class MyClass { String s int z Myclass(int y) { z = y } } fill in the blanks (labelled i., ii. and iii.) in the definition of the method main, of the class StringProcessing, with i. a declaration of a variable named obj of type MyClass, initialised with a MyClass object so that its instance variable z has a value of 20, ii. an assignment of the instance...

  • Which of the following statements is false? Select one: a. The string returned from class Throwable's...

    Which of the following statements is false? Select one: a. The string returned from class Throwable's getMessage method contains the name of the exception's class. b. The class Throwable provides the method getMessage that returns the descriptive string stored in an exception. c. All exceptions must derive from the class Throwable. d. The class Throwable provides the method getStackTrace that outputs the stack trace to the standard error stream.

  • //Write a recursive function that, given an input string str, replaces all occurrences of a character...

    //Write a recursive function that, given an input string str, replaces all occurrences of a character a by a character b in str. (C++) void replace_chr(char *str, char a, char b){ }

  • please write in c++. 4 Derived class JPG 4.1 Class declaration • The class JPG inherits...

    please write in c++. 4 Derived class JPG 4.1 Class declaration • The class JPG inherits from File and is a non-abstract class. 1. Hence objects of the class JPG can be instantiated. 2. To do so, we must override the pure virtual function clone() in the base class. • The class declaration is given below. class JPG : public File { public: JPG(const std::string& n, int n, int w, const double rgb()) : File(...) { // ... } *JPG()...

  • Find Output. Just output. No explanation needed.. #include <iostream> #include <string> using namespace std; class baseClass...

    Find Output. Just output. No explanation needed.. #include <iostream> #include <string> using namespace std; class baseClass { public: void print() const; baseClass(string s = " ", int a = 0); //Postcondition: str = s; x = a; protected: int x; private: string str; }; class derivedClass: public baseClass { public: void print() const; derivedClass(string s = "", int a = 0, int b = 0); //Postcondition: str = s; x = a; y = b; private: int y; }; int...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT