Question: using c++ language divide program to main.cpp,vegie.h,vegie.cpp need use g++ -o count vegie.cpp main.cpp in terminal to compile Define and implement a class named vegie
using c++ language
divide program to main.cpp,vegie.h,vegie.cpp
need use "g++ -o count vegie.cpp main.cpp "in terminal to compile
Define and implement a class named vegie. A vegie object represents an animal that only eats vegetables. The vegie class must be defined by inheriting from the animal class. The vegie class has the following public constructors and behaviours:
vegie(string aSpecies); // create a vegie of the given species, its favourite food is "Grass" void set_favourite_food(string aVegie); // change the vegie's favourite food string getFavouriteFood();
Your main program should create a vegie object to represent a "Goat" and record its favourite food as being "Hats". The vegie object initially has "Grass" recorded as its favourite food. Your main program must demonstrate that the favourite food can be changed.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
