Adding assignments
This commit is contained in:
14
Animals/Animal.cs
Normal file
14
Animals/Animal.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace OOP
|
||||
{
|
||||
public abstract class Animal
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public abstract void MakeSound();
|
||||
|
||||
public void Feed()
|
||||
{
|
||||
Console.WriteLine("Feeding the animal");
|
||||
}
|
||||
}
|
||||
}
|
||||
17
Animals/Elephant.cs
Normal file
17
Animals/Elephant.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using OOP;
|
||||
|
||||
namespace OOP.Animals
|
||||
{
|
||||
public class Elephant : Animal
|
||||
{
|
||||
public Elephant()
|
||||
{
|
||||
this.Name = this.GetType().Name;
|
||||
}
|
||||
|
||||
public override void MakeSound()
|
||||
{
|
||||
Console.WriteLine("Elefant lyde");
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Animals/Lion.cs
Normal file
15
Animals/Lion.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace OOP.Animals
|
||||
{
|
||||
public class Lion : Animal
|
||||
{
|
||||
public Lion()
|
||||
{
|
||||
this.Name = this.GetType().Name;
|
||||
}
|
||||
|
||||
public override void MakeSound()
|
||||
{
|
||||
Console.WriteLine("Rawr");
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Animals/Parrot.cs
Normal file
15
Animals/Parrot.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace OOP.Animals
|
||||
{
|
||||
public class Parrot : Animal
|
||||
{
|
||||
public Parrot()
|
||||
{
|
||||
this.Name = this.GetType().Name;
|
||||
}
|
||||
|
||||
public override void MakeSound()
|
||||
{
|
||||
Console.WriteLine("Sqawk");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user