动物类继承

// Note:Your choice is C++ IDE
#include
using namespace std;
class Animal{
 public:
 int feet;
 int hands;
 virtual void move(){};
 };
class Fish:public Animal{
 public:
 int feet;
 int hands;
 int set1(){
  feet=0;
  return feet;}
 int set2(){ 
  hands=0;
  return hands;} 
 void move(){
  cout<<"Fish"<     cout<<"Feet:  "<     cout<<"Hands:  "<  cout<<"Fish can move by swimming!"<};


class Bird:public Animal{
 public:
 int feet;
 int hands;
 int set1(){
  feet=2;
  return feet;}
 int set2(){ 
  hands=0;
  return hands;} 
 void move(){
  cout<<"Bird"<     cout<<"Feet:  "<     cout<<"Hands:  "<  cout<<"Fish can move by swimming!"<};
int main()
{
    Fish f;
    f.move();
    Bird b;
    b.move();
    return 0;
}

你可能感兴趣的:(常用工具类)