Question

47 What is printed out by the code listed below the classes (i.e., below the line)? class Animal public virtual void whoAreYou () cout << an Animal\n;h class Insect public Animal public void whoAreYou() cout < an Insect\n; class Spider public Insect public void whoAreYou() cout << a Spider\n; Animal* a1-new Animal; Animal* a2 = new insect ; Animal* a3 = new spider; al->whoAreYou ); a2->whoAreYou ); ??->whoAreYou ( ) ; an Insect, a Spider, a Spider O an Animal, an Animal, an Insect O O an Animal, an Insect, a Spider an Insect, an Insect, a Spider an Animal, an Animal, an Animal

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

Solution:

Answer 47:
c. an animal, an insect, a spider

Answer 50:
b. Inserting a node at the back

Add a comment
Know the answer?
Add Answer to:
47 What is printed out by the code listed below the classes (i.e., below the line)?...
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
  • What will be printed by the code below What will be printed by the code below...

    What will be printed by the code below What will be printed by the code below #include <iostream> using namespace std; class A { public: A() {cout << "+1";} ~A() {cout << "-1";} }; class B: public A { public: B() {cout << "+2";} ~B() {cout << "-2";} }; class C: public B { publc: C() {cout << "+3";} ~C() {cout << "-3";} }; int main() { A a1; B b1; A *a2 = new A; B *b2; = new...

  • Given the following code: #include <iostream> #include <iomanip> using namespace std; class Animal{ private: int height;...

    Given the following code: #include <iostream> #include <iomanip> using namespace std; class Animal{ private: int height; int weight; public: void setHeight(int h){ height = h; } int getHeight(){ return height; } void setWeight(int w){ weight = w; } int getWeight(){ return weight; } virtual void makeSound() = 0; virtual void eat(); }; class Dog: public Animal{ public: void makeSound(){ cout << "Bow Bow\n"; } void eat (){ cout <<"The dog is eating\n"; } void Catch(){ cout << "The dog is...

  • Extend the example program creature.cpp by adding two other type of creatures (i.e., two new classes...

    Extend the example program creature.cpp by adding two other type of creatures (i.e., two new classes derived from Creature) with some example properties and methods (use your imagination for doing this). Use/implement at least one property and at least one method for each derived class. Each constructor, destructor and method should be implemented in such a way that each call is being documented via messages printed on the screen. Create one instance of Wizard, two instances of the two other...

  • Create a base class and two derived classes. Also, create and call a member function named...

    Create a base class and two derived classes. Also, create and call a member function named communicate() that behaves differently when called by each class. Create a single C++ project (and CPP source file) named animal_communication as follows: Into this source, type the source code for Program 15-16, "Program Output," in Section 15.6, "Polymorphism and Virtual Member Functions," in Ch. 15, "Inheritance, Polymorphism, and Virtual Functions," of Starting Out With C++ From Control Structures Through Objects. Run and debug the...

  • C++ Programming QUESTION 10 Based on the following C++ code, what is the output of "pvari->print("...

    C++ Programming QUESTION 10 Based on the following C++ code, what is the output of "pvari->print(" function call? class A public void print cout << "Hello from A": 1 virtual void print2() {cout << "Hello from A2";} class B public A public void print) { cout << "Hello from B:1 virtual void print2() {cout << "Hello from B2": 1 int main() Avari Apvarl-new B; return 0; 1 o a Hello from A2 ob Hello from B O Hello from A...

  • previous assignment code /*C++ test program to test the classes, Animal, Mammal and Cat and print...

    previous assignment code /*C++ test program to test the classes, Animal, Mammal and Cat and print the results on console window.*/ //Main.cpp //include header files #include<iostream> //include Animal, Mammal and Cat header files #include "Animal.h" #include "Mammal.h" #include "Cat.h" using namespace std; int main() {    //create Animal object    Animal animal("Dog","Mammal",4);    cout<<"Animal object details"<<endl;    cout<<"Name: "<<animal.getName()<<endl;    cout<<"Type: "<<animal.getType()<<endl;    cout<<"# of Legs: "<<animal.getLegs()<<endl;          cout<<endl<<endl;    //create Cat object    Cat cat("byssinian cat","carnivorous mammal",4,"short...

  • C# - Inheritance exercise I could not firgure out why my code was not working. I...

    C# - Inheritance exercise I could not firgure out why my code was not working. I was hoping someone could do it so i can see where i went wrong. STEP 1: Start a new C# Console Application project and rename its main class Program to ZooPark. Along with the ZooPark class, you need to create an Animal class. The ZooPark class is where you will create the animal objects and print out the details to the console. Add the...

  • Ship, CruiseShip, and CargoShip Classes (in C++ language i use visual studios to code with) design...

    Ship, CruiseShip, and CargoShip Classes (in C++ language i use visual studios to code with) design a Ship class that has the following members: - A member variable for the name of the ship (a string) - A member variable for the year that the ship was built (a string) - A contsructor and appropriate accessors and mutators - A virtual print function that displays the ship's name and the year it was built (nobody seems to get this part...

  • What value is printed out from the code below? public void square(double x) { double x...

    What value is printed out from the code below? public void square(double x) { double x = x * x; } : double val = 10; square(val); System.out.println(val);

  • JAVA question: Please see the code posted below and improve it so it allows for: 1.new...

    JAVA question: Please see the code posted below and improve it so it allows for: 1.new aircraft are entered [new objects] 2.these objects are automatically be assigned their unique IDs [unique ID linked to a static class variable?] 3.will not be automatically given airport codes [initialise airportCode as null in the constructor] 4.assign an airport code to each new aircraft [an object method?] The code: class Aeroplane { static int planeCount = 0; static int codeGenerator = 0; int uniqueID...

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