Here is my attempt at an object oriented animal Hierarchy, I'm stuck from here, don't look at the content (what they say) it might be goofy and wrong!...
My questions, How do I go about creating an operate Animal function, I'll end up throwing these into vectors and such, what would my next step from here be?
Code:
#include <iostream.h>
class Animals
{
public:
Animals();
~Animals();
virtual void Movement()
{
}
virtual void Eat()
{
}
};
class Mammals : public Animals
{
public:
Mammals();
~Mammals();
void Movement()
{
cout << "I use my legs!" << endl;
}
void Eat()
{
cout << "I eat anything I can find!" << endl;
}
};
class Reptiles : public Animals
{
public:
Reptiles();
~Reptiles();
void Movement()
{
cout << "I use my legs and slither!" << endl;
}
void Eat()
{
cout << "I usually eat meat!" << endl;
}
};
class Birds : public Animals
{
public:
Birds();
~Birds();
void Movement()
{
cout << "I fly for the most part, some of the oddballs walk!" << endl;
}
void Eat()
{
cout << "I usually eat meat!" << endl;
}
};
class Amphibians : public Animals
{
public:
Amphibians();
~Amphibians();
void Movement()
{
cout << "I generally crawl with my legs, and slither, AND swim!" << endl;
}
void Eat()
{
cout << "I usually eat meat!" << endl;
}
};
class Fish : public Animals
{
public:
Fish();
~Fish();
void Movement()
{
cout << "You guessed it, I swim! (some of us get beached though, stupid fat whales!)" << endl;
}
void Eat()
{
cout << "I eat anything I can find in the water!" << endl;
}
};
int main()
{
return 0;
}