Corrected enum code declaration. (#32854)

* Corrected enum code. Cannot declare:
public enum phylum;
Since this code will produce an error. If someone will copy the same code, it will not compile and run. I updated the code so that when someone will copy the code, it will not produce an error.

* I also updated the spacing and tabbing on code.
* Corrected the constructor DefineAnimal to Animal since the name of the class is Animal and DefineAnimal will produce an error.
* Remove enum on parameter of constructor since this will produce an error.
* Corrected class Dog as public enum breed will produce an error.
This commit is contained in:
Willy David Jr
2019-06-28 14:39:32 +08:00
committed by Randell Dawson
parent 62ba46f9ce
commit 49c2c7164a

View File

@ -32,15 +32,18 @@ public class Animal
{
public int ID;
public string title;
public enum phylum;
public enum dietType;
public enum phylum { };
public enum dietType { };
public DefineAnimal(int id, string name, enum phy, enum diet)
public phylum _phylum;
public dietType _dietType;
public Animal(int id, string name, phylum phylum, dietType diet)
{
this.ID = id;
this.ID = ID;
this.title = name;
this.phylum = phy;
this.dietType = diet;
this._phylum = phylum;
this._dietType = diet;
}
}
@ -50,7 +53,7 @@ public class Animal
```
public class Dog : Animal
{
public enum breed;
public enum breed { };
public int levelOfTraining;
public void SayWoof()