哪个类更适合未来的实现?突击掠食者(多重继承)还是女王(多层次等级)?
#include "stdafx.h"
#include<stdlib.h>
class living
{
public:
int hitpoints;
int adaptation;
};
class alien:public living
{
public:
bool tail;
bool claws;
bool legs;
bool secondary_jaws;
bool acid_blood;
alien(){adaptation=1000;hitpoints=50;}
};
class queen:public alien
{
public:
bool ovipositor;
bool tertiary_jaws;
};
class predator
{
public:
bool legs;
bool arms;
bool glowstick_blood;
};
class assault_predator:public living,public predator
{
public:
bool plasma_caster;
bool infrared_vision;
assault_predator(){hitpoints=150;adaptation=33;}
};
int main()
{
assault_predator player1;
queen player2;
getchar();
return 0;
}
正如所见,攻击性捕食者分别来自生活和捕食者。女王来自外星人,外星人来自生活。
问题:就编程和类层次结构而言,哪一个更合乎逻辑。
这些球员的优缺点是什么?