Question: catDogs.cpp #include #include Cat.h #include Dog.h int main(int argc, const char * argv[]) { Animal * someAnimal; someAnimal = new Dog(); someAnimal->talk(); delete someAnimal; someAnimal

catDogs.cpp
#include#include "Cat.h" #include "Dog.h" int main(int argc, const char * argv[]) { Animal * someAnimal; someAnimal = new Dog(); someAnimal->talk(); delete someAnimal; someAnimal = new Cat(); someAnimal->talk(); delete someAnimal; return 0; }
-------------------------------------------------------------
Dog.h
#pragma once #include "Animal.h"
class Dog : public Animal {
public:
Dog() : Animal() {
}
Dog(string n, int a) : Animal(n, a) {
}
void talk() { cout
-------------------------------------------------------------
Cat.h
#pragma once #include "Animal.h"
class Cat : public Animal { public: Cat() : Animal() {
} Cat(string n, int a) : Animal(n, a) {
}
void talk() { cout
-------------------------------------------------------------
Animal.h
#pragma once #include
using namespace std;
class Animal { string name; int age;
public:
Animal() { name = "Generic Name"; age = 0; }
Animal(string n, int a) { name = n; age = a; }
};
-------------------------------------------------------------
Study the files catsDogs.cpp, Cat.h, Dog.h and Animal.h. The program does not compile in its current form. A piece of code is missing from Animal.h. Add that code and submit the new Animal.h. Sample output from catsDogs.cpp Woof, woof! Meow, meow
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
