T
Tony Johansson
Hello!
Here I have two enum definitions MammalSpecies and BirdSpecies and the two
abstract classes Mammal and Bird.
I think it was a good idea first to put mammal in one enum and Bird in
another enum
but the problem come when I'm about to pass the data enum mammal up to the
base class Animal and when I pass the data enum bird up to the base class
Animal. I just wonder what is the bast way to receive the two different enum
MammalSpecies and BirdSpices in the Animal class. I can define a new enum
called AnimalSpices that would receive the mammal and bird but that seems
like a bad idea. The main point is that I want to store what type of animal
it is like dog, cat, pelican and eagle and so in the base class Animal.
Another solution that might be better is to forget this MammalSpecies and
BirdSpecies but instead put all the animals into one enum AnimalSpices that
I can also use in the base class Animal.
What do you think ?
public enum MammalSpecies
{
Dog, Cat
}
public enum BirdSpecies
{
pelican, eagle
}
abstract class Mammal : Animal
{
const int MammalNumberOflegs = 4;
const double NormalBodyTemerature = 37.0;
private double temperature = NormalBodyTemerature;
private int numberOfLegs = MammalNumberOflegs;
private SkinType skin;
private bool trained;
private bool intelligent;
public Mammal(CategoryType category, MammalSpecies mammal, string
name, string id, double age, GenderType gender,
HousingType housing, EaterType eater, bool aggressive,
List<string> foodMenyList)
: base(category, mammal, name, id, age, gender, housing, eater,
aggressive, foodMenyList)
{}
....
}
abstract class Bird : Animal
{
public Bird(CategoryType category, BirdSpecies bird, string name, string
id, double age, GenderType gender, HousingType housing, EaterType
eater, bool aggressive, List<string> foodMenyList)
: base(category, bird, name, id, age, gender, housing, eater,
aggressive, foodMenyList)
{}
....
}
//Tony
Here I have two enum definitions MammalSpecies and BirdSpecies and the two
abstract classes Mammal and Bird.
I think it was a good idea first to put mammal in one enum and Bird in
another enum
but the problem come when I'm about to pass the data enum mammal up to the
base class Animal and when I pass the data enum bird up to the base class
Animal. I just wonder what is the bast way to receive the two different enum
MammalSpecies and BirdSpices in the Animal class. I can define a new enum
called AnimalSpices that would receive the mammal and bird but that seems
like a bad idea. The main point is that I want to store what type of animal
it is like dog, cat, pelican and eagle and so in the base class Animal.
Another solution that might be better is to forget this MammalSpecies and
BirdSpecies but instead put all the animals into one enum AnimalSpices that
I can also use in the base class Animal.
What do you think ?
public enum MammalSpecies
{
Dog, Cat
}
public enum BirdSpecies
{
pelican, eagle
}
abstract class Mammal : Animal
{
const int MammalNumberOflegs = 4;
const double NormalBodyTemerature = 37.0;
private double temperature = NormalBodyTemerature;
private int numberOfLegs = MammalNumberOflegs;
private SkinType skin;
private bool trained;
private bool intelligent;
public Mammal(CategoryType category, MammalSpecies mammal, string
name, string id, double age, GenderType gender,
HousingType housing, EaterType eater, bool aggressive,
List<string> foodMenyList)
: base(category, mammal, name, id, age, gender, housing, eater,
aggressive, foodMenyList)
{}
....
}
abstract class Bird : Animal
{
public Bird(CategoryType category, BirdSpecies bird, string name, string
id, double age, GenderType gender, HousingType housing, EaterType
eater, bool aggressive, List<string> foodMenyList)
: base(category, bird, name, id, age, gender, housing, eater,
aggressive, foodMenyList)
{}
....
}
//Tony